Next: Null Pointers, Previous: Integer Overflow, Up: Portable C and C++
In C99, preprocessor arithmetic, used for #if
expressions, must
be evaluated as if all signed values are of type intmax_t
and all
unsigned values of type uintmax_t
. Many compilers are buggy in
this area, though. For example, as of 2007, Sun C mishandles #if
LLONG_MIN < 0
on a platform with 32-bit long int
and 64-bit
long long int
. Also, some older preprocessors mishandle
constants ending in LL
. To work around these problems, you can
compute the value of expressions like LONG_MAX < LLONG_MAX
at
configure
-time rather than at #if
-time.