This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: comparisons..
Andrew Morton wrote:
[ ... This looks a lot like what happened when we first turned on
warnings while building gcc ... ]
> I'm told that the compiler will warn for this code:
>
> unsigned int i;
> if (i > 5) /* 'i' is unsigned, '5' is signed, so warn */
>
> which makes this warning hard to use more than occasionally.
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 ?
[ Take this for what it's worth - Fortran doesn't know of unsigned
quantities, and we're all the happier because of it ;-) ]
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://g95.sourceforge.net/ (under construction)