You can check if your C99 compiler matches the numbers in the preprocessor with this
# if (~0U < 18446744073709551615U)
This works because all unsigned values (in the preprocessor) must be of the same type as uintmax_t , and therefore 0U is of type uintmax_t and ~0U , 0U-1 and -1U all the maximum representable numbers.
If this test works, the chances are high that the unsigned long long is actually uintmax_t .
For correct expression after the preprocessing phase to test this with real do types
unsigned long long has_ullong_max[-1 + 2*((0ULL - 1) >= 18446744073709551615ULL)];
This does the same trick, but uses the ULL postfix to have constants like unsigned long long .
Jens gustedt
source share