Constant is too large for long long
Technical Note 87534
I get the message:
Warning[Pe1297]: constant is too large for long long; given unsigned long long type (nonstandard)
.. when using the decimal constant 2147483648.
- Use suffix (e.g., 2147483648UL)
- Use octal or hexadecimal representation instead (e.g., 0x80000000)
- Combine constants that are not too large, e.g., use LONG_MIN defined as
#define LONG_MIN (-2147483647-1)
The standard says the type of a decimal constant without suffix shall be the first that matches in the following list:
int, long int, long long int
The constant 2147483648 (= 0x8000 0000) does not fit in a long long int.
The compiler handles this by using unsigned long long int for the constant, and gives an appropriate warning.
Type casts, e.g.,
/*...*/ (unsigned long long) 2147483648; /*...*/
are not applied until after the constant has a type. See also Technical Note 60149.
All product names are trademarks or registered trademarks of their respective owners.