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
[cstdint] Fix macro name patterns #663
Conversation
Min/max value macro names for exact-width integer types are like INT8_MIN, not INT_8_MIN.
INT_[FAST LEAST]{8 16 32 64}_MIN | ||
[U]INT_[FAST LEAST]{8 16 32 64}_MAX | ||
INT[_FAST _LEAST]{8 16 32 64}_MIN | ||
[U]INT[_FAST _LEAST]{8 16 32 64}_MAX | ||
INT{MAX PTR}_MIN |
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.
Thanks for the fix. Perhaps we could take this opportunity to further improve the presentation here, and shift away from this ambiguous and unexplained notation. Perhaps a grammar fragment:
min-max-macro:
signed-type
_MIN
signed-type_MAX
unsigned-type_MAX
signed-type:
sized-type-prefix size
one ofINTMAX
INTPTR
PTRDIFF
SIG_ATOMIC
WCHAR
WINT
unsigned-type:
U
sized-type-prefix size
one ofUINTMAX
UINTPTR
SIZE_MAX
sized-type-prefix: one of
INT
INT_FAST
INT_LEAST
size: one of
8
16
32
64
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.
I think just following the C standard may be better: define italic N
for {8 16 32 64} and just enumerate others literally. The list fits in
285 chars, while your grammer goes 299 chars. (These numbers exclude
markups, and all word separators (including indents) are counted as 1.
Expanding {8 16 32 64} goes 663 chars.)
INT_N__MIN INT_FAST_N__MIN INT_LEAST_N__MIN
INT_N__MAX INT_FAST_N__MAX INT_LEAST_N__MAX
UINT_N__MAX UINT_FAST_N__MAX UINT_LEAST_N__MAX
INTMAX_MIN INTPTR_MIN
INTMAX_MAX INTPTR_MAX
UINTMAX_MAX UINTPTR_MAX
PTRDIFF_MIN SIG_ATOMIC_MIN WCHAR_MIN WINT_MIN
PTRDIFF_MAX SIG_ATOMIC_MAX WCHAR_MAX WINT_MAX
SIZE_MAX
From C99 7.20.1 p2
In the following descriptions, the symbol N represents an unsigned
decimal integer with no leading zeros (e.g., 8 or 24, but not 04 or 048).
As a bonus, some macros will become literally searchable.
@k-satoda: Hi, are you still around? Could you please rework this PR as zygoloid described? Thanks! |
@tkoeppe Thank you for the reminder. I'll try, but after looking through |
@k-satoda: It's up to you! If you don't want to do this, just close this PR and I can pick up this issue. I think I have an idea what to do here, so I wouldn't mind. Either way is fine :-) |
I'm on it, leave it with me. Thanks for bringing this up! |
Min/max value macro names for exact-width integer types are like
INT8_MIN, not INT_8_MIN.