This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: constant signed/unsigned comparison warning
- To: erik at arbat dot com (Erik Corry)
- Subject: Re: constant signed/unsigned comparison warning
- From: "Matthias Urlichs" <smurf at noris dot de>
- Date: Wed, 24 Sep 1997 22:04:32 +0200 (Funky)
- Cc: Thomas dot Koenig at ciw dot uni-karlsruhe dot de, smurf at noris dot de, egcs at cygnus dot com, gcc2 at cygnus dot com
Hi,
Erik Corry wrote:
>
>1) Cast. Ugly.
Right.
>2) Disable warning. This is what happens in the real world.
> Unfortunately the usual method may be to avoid -Wall.
Signed/unsigned warnings are _not_ turned on by -Wall, they're turned on by
-W (which is not implied in -Wall).
>3) Make ssize_t a 'special type' (that suppresses this warning
> when comparing with a constant) in gcc. Ugly for gcc
> implementers. Nice for gcc users.
>
Apparently, especially ugly for people with other compilers who actually
might run into problems when GCC does something like this.
Oh well, can't win every time. However, new idea:
4) Make sizeof() be standard-as-The-Book-says unsigned. Make __sizeof__
behave like I proposed. People who want the incompatible thing can just
#define sizeof(x) __sizeof__(x)
and be sure that other, non-GCC, compilers will barf (because they don't
know zilch about any __sizeof__). Everybody wins. Hopefully.
5) We continue this somewhat-heated exchange until everybody is fed up
with it.
Frankly, I'd prefer (4)...
--
Matthias Urlichs
noris network GmbH