Re: Windows 64 port

On 03/22/2012 10:31 AM, Fabrice Popineau wrote:
> The constant is generated by the preprocessor.
> So it is not a compiler bug but a good catch from the compiler.
> Luckily, the code is not executed. Given the rather deep stack
> of macros, if it were executed without any warning, it would be
> difficult to catch by hand.
The code cannot possibly be executed, so it's not a good
catch by the compiler. Here's a simpler example:
#define Z 0
#define FOO (Z == 0 ? INT_MAX : 1000 / Z)
int i = FOO;
Here, the compiler should not complain about division by zero,
even though the constant is generated by the preprocessor,
because FOO's body is designed to divide by Z only when
Z is nonzero, and the expression 1000 / Z cannot possibly be
executed when Z is zero. Of course compilers are free to generate
warnings whenever they like, and some will indeed warn about this
example if you enable the right flags, but this warning is harmful
and not helpful: it should be ignored and the code should not be
changed and you're better off simply disabling the compiler warning.
The situation with the INT_RANGE_OVERFLOW check is similar, except
there the macro is more like this:
#define a 2147483647
#define b 1
#define FOO (INT_ADD_OVERFLOW (a,b) ? INT_MAX : (a)+(b))
int i = FOO;
Again, any compiler that warns about potential overflow of
2147483647+1 should be ignored, because the expression
2147483647+1 cannot possibly be evaluated.