Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

k-satoda
Copy link
Contributor

Min/max value macro names for exact-width integer types are like
INT8_MIN, not INT_8_MIN.

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
Copy link
Member

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 of INTMAX INTPTR PTRDIFF SIG_ATOMIC WCHAR WINT

unsigned-type:

U sized-type-prefix size
one of UINTMAX UINTPTR SIZE_MAX

sized-type-prefix: one of INT INT_FAST INT_LEAST

size: one of 8 16 32 64

Copy link
Contributor Author

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.

@zygoloid
Copy link
Member

Let's handle this as @k-satoda suggests (with an italic N), and list these as

#define INT_N__MAX implementation-defined

in the synopsis, following the direction of p0175.

@tkoeppe
Copy link
Contributor

tkoeppe commented Jul 21, 2016

@k-satoda: Hi, are you still around? Could you please rework this PR as zygoloid described? Thanks!

@k-satoda
Copy link
Contributor Author

@tkoeppe Thank you for the reminder. I'll try, but after looking through
the result of p0175. It will take a few days. If someone finds this as
an easy work, please feel free to takeover.

@tkoeppe
Copy link
Contributor

tkoeppe commented Jul 21, 2016

@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 :-)

@tkoeppe
Copy link
Contributor

tkoeppe commented Jul 21, 2016

I'm on it, leave it with me. Thanks for bringing this up!

@tkoeppe tkoeppe closed this Jul 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants