GCC 3.3.2: Some bug in the preprocessor?
Look, this defun returns 0, and this is correct:
tst()
{
#if (unsigned)0 > -1
return 1;
#else
return 0;#endif
}
But this one returns 1, and this is incorrect:
tst()
{
#if 0 > (unsigned)-1
return 1;
#else
return 0;#endif
}
What's wrong?
You cannot use casts in #if. Your conditionals are read as
#if (0)0 > -1
which produces a syntax error;
#if 0 > (0)-1
which evaluates as 0 > 0 - 1 which is true.
zw
Quoted 6 lines · Zack Weinberg
You cannot use casts in #if. Your conditionals are read as
#if (0)0 > -1
which produces a syntax error;
Oh, ok, thanks. I've missed the error message...