comparisons..
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Fri Jul 14 14:00:00 GMT 2000
> I always wondered whether it would be possible to drop the warning in
> case the signed constant has the same value when interpreted as an
> unsigned value. Obviously, it is useful to compare an unsigned variable
> against a _positive_ constant, even if it - strictly according to the
> rules - should be interpreted as a signed quantity. Or is this a
> promotion-hair issue ?
The warning is not justified in this case. The integer constant is
converted into an unsigned integer, and standard C guarantees that
there will be no change in value due to this conversion. So writing
x > 5
is guaranteed to be the same thing as
x > 5U
Regards,
Martin
More information about the Gcc
mailing list