In the following code, assume ints are 16 bits.
int f(void)
{
int i = 0;
return i > 0xffff;
}
Because the hexadecimal constant’s type is either int (with a value of– 1 on a two’s-complement machine) or an unsigned int (with a value of 65535), the comparison is true in -Xs and -Xt modes, and false in -Xa and -Xc modes or when -std flag is specified.
Again, an appropriate cast clarifies the code and suppresses a warning:
-Xt, -Xs modes:
i > (int)0xffff
-Xa, -Xc modes, or when -std flag is specified:
i > (unsigned int)0xffff
or
i > 0xffffU
The U suffix character is a new feature of ISO C and probably produces an error message with older compilers.