This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: constant signed/unsigned comparison warning
- To: egcs at cygnus dot com, gcc2 at cygnus dot com
- Subject: Re: constant signed/unsigned comparison warning
- From: Per Bothner <bothner at cygnus dot com>
- Date: Wed, 24 Sep 1997 12:43:28 -0700
Instead of:
if (i == -1) {
...
}
else if (i < sizeof(foo)) {
...
}
what about:
if (i < 0) {
...
}
else if (i < sizeof(foo)) {
...
}
This is at least as clean, and this is something we *could* teach gcc
to recognize. (It would require some simple range analysis in Gcc,
but that is going to be very desirable anyway. Some support may
already have been added.)
--Per Bothner
Cygnus Solutions bothner@cygnus.com http://www.cygnus.com/~bothner