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

INTn_MIN, INTn_MAX violate C99 specification #8

Open
GoogleCodeExporter opened this issue Mar 14, 2015 · 0 comments
Open

INTn_MIN, INTn_MAX violate C99 specification #8

GoogleCodeExporter opened this issue Mar 14, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

According to ISO/IEC 9899:TC3 7.18.2.2,

"Each instance of [INTn_MIN and INTn_MAX] shall be replaced by a constant 
expansion suitable for use in #if preprocessor directives, and this expression 
shall have the same type as would an expression that is an object of the 
corresponding type converted according to the integer promotions"

The INTn_MAX macros always violated the second requirement, and r19 means that 
the INTn_MIN macros now violate both requirements.

The recommended solution would be to define the INTn_MIN / INTn_MAX macros as 
follows:

#define INT8_MIN     (_I8_MIN + 0)
#define INT8_MAX     (_I8_MAX + 0)
#define INT16_MIN    (_I16_MIN + 0)
#define INT16_MAX    (_I16_MAX + 0)
#define INT32_MIN    (_I32_MIN + 0)
#define INT32_MAX    (_I32_MAX + 0)
#define INT64_MIN    (_I64_MIN + 0)
#define INT64_MAX    (_I64_MAX + 0)
#define UINT8_MAX    (_UI8_MAX + 0)
#define UINT16_MAX   (_UI16_MAX + 0)
#define UINT32_MAX   (_UI32_MAX + 0)
#define UINT64_MAX   (_UI64_MAX + 0)

Original issue reported on code.google.com by [email protected] on 5 Aug 2010 at 6:28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant