New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[limits] Integrate section [limits.numeric] into section [numeric.lim… #1159
Conversation
Fine by me. |
This cleanup seems to lose the introductory nature of the first paragraph. Perhaps let's promote the original [limits.numeric]/1 to [limits]/1 instead of moving it so far down?
… On Nov 30, 2016, at 12:53 PM, Jens Maurer ***@***.***> wrote:
…its].
Fixes #785.
You can view, comment on, or merge this pull request online at:
#1159
Commit Summary
• [limits] Integrate section [limits.numeric] into section [numeric.limits].
File Changes
• M source/support.tex (68)
Patch Links:
• https://github.com/cplusplus/draft/pull/1159.patch
• https://github.com/cplusplus/draft/pull/1159.diff
|
@W-E-Brown: Hm... But the introductory sentence in the first paragraph only mentions numeric_limits, but the synopsis also has float_round_style and float_denorm_style. At this point, it's not clear these are related to the numeric_limits template. That said, I do admit there is little besides numeric_limits in the [limits] section. 18.3.1 already has an introductory sentence that says " specs follow". Other opinions? |
The entire structure of 18.3.2 is weird. Anywhere else in the Standard we would structure it like this:
That is, the synopsis is the first sibling in a subclause that describes the things that are listed in the synopsis. That's how we do it for most other library components. A "General" section could optionally precede the synopsis, but only if there's something useful to say. (I think the origin of "General" sections lies in the ISO drafting directives which say never to have "mixed" content in a subclause, i.e. paragraphs and sub-subclauses.) |
In a hypothetical world, and given that we now have full synopses for the C library, I could even imagine the following structure:
The last two sections, marked |
A mild issue with all the presentation options so far is that float_round_style and float_denorm_style are used in the definition of numeric_limits. It would be good to introduce/explain them before the numeric_limits template. Also, when extracting the synopses, 18.3.6 "C library" becomes empty. I'd also like to point out that we have a subsection "C library" in clause 27, too, and we just have the synopses under this subsection with a one-sentence "same as in C" statement. Ok, but elsewhere (e.g. in the "strings" clause), the C library stuff is just adjoint to the C++ stuff, without particularly highlighting it's from C. |
Ok, I've done something along @tkoeppe 's "hypothetical world". I like it now. (Note that I expressly only moved sections, added/removed subsection headings, and fixed cross-references.) |
No longer hypothetical, eh? I like it. |
- Change order of subsections. - Remove [limits] and [c.limits] subsection headings. - Move descriptions of numeric_limits members and specializations as subsections under the description of the primary class template. - Add sectioning comments to the <limits> synopsis. Fixes cplusplus#785.
Rebased. |
\tcode{numeric_limits} | ||
template, specializations shall define these values in such a way | ||
that they are usable as | ||
constant expressions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this paragraph? What alternative is being excluded here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, there are member functions declared "static constexpr" (such as infinity()
), and users can specialize numeric_limits
for their own types. Since a function can be declared constexpr
, yet not be usable in a constant expression, my guess is that this essentially requires that "T" doesn't access global or volatile variables when copied. (Such a copy is required for the return value of infinity()
, for example.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this applies to user specializations. Seems weird to put a "shall" on that, but OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also LWG 2833 "Library needs to specify what it means when it declares a function constexpr".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question, but I'm fine with merging this as-is.
Tip for the future: Please always check the overfull box status for your proposed change:
|
Alerted Marshall Clow (LWG chair) to this change. |
…its].
Fixes #785.