constant signed/unsigned comparison warning
Matthias Urlichs
smurf@noris.de
Wed Sep 24 13:04:00 GMT 1997
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
More information about the Gcc
mailing list