Skip to content

[cfloat.syn], [cmath.syn] Add missing "// optional" comments for some macros - #9254

Open
eisenwave wants to merge 2 commits into
cplusplus:mainfrom
eisenwave:patch-67
Open

[cfloat.syn], [cmath.syn] Add missing "// optional" comments for some macros#9254
eisenwave wants to merge 2 commits into
cplusplus:mainfrom
eisenwave:patch-67

Conversation

@eisenwave

Copy link
Copy Markdown
Member

All of these macros are optionally defined, if and only if the constant is actually representable in the type.

See https://cstd.eisie.net/c23#5.2.5.3.3p28

@eisenwave
eisenwave requested a review from jwakely August 13, 2026 07:25
Comment thread source/support.tex
#define @\libmacro{FLT_SNAN}@ @\seebelow@
#define @\libmacro{DBL_SNAN}@ @\seebelow@
#define @\libmacro{LDBL_SNAN}@ @\seebelow@
#define @\libmacro{INFINITY}@ @\seebelow@ // optional

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also change [cmath.syn] for INFINITY and NAN. Also, we should indent these comments.

INFINITY was mandatory in the published C99/C11/C17, and then N2848 changed it to conditionally-supported. It seems that before N2848 INFINITY was required to be defined as something nonsense if the implementation doesn't support infinity.

I think WG14 N2848 should be treated as DR, but I'm nor sure whether we should add some entry to Annex C.

@eisenwave eisenwave Aug 14, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added the changes to [cmath.syn]. If this is basically a DR, then I don't see a need for an Annex C entry. We have always had the same contents as the C header, and the C header just got some bug-fixes, so it's not really like something changed in C++.

Comment thread source/support.tex
@eisenwave
eisenwave requested a review from jensmaurer August 14, 2026 08:40
@eisenwave eisenwave changed the title [cfloat.syn] Add missing "// optional" comments for some macros [cfloat.syn], [cmath.syn] Add missing "// optional" comments for some macros Aug 14, 2026

@jensmaurer jensmaurer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwakely , this seems correct. Please have a look.

@eisenwave eisenwave added the P2-Bug Presentational errors and omissions label Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2-Bug Presentational errors and omissions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants