constant signed/unsigned comparison warning

Erik Corry erik@arbat.com
Wed Sep 24 15:46:00 GMT 1997


Matthias Urlichs:
> Erik Corry:
>
> >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.

Why does this cause problems? People with other compilers can
just disable signed/unsigned warnings entirely. Gcc users get
just the warnings that (might) matter, and none of the others.
Gcc has always been great at warnings.

> 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)

What's the advantage of this above just disabling the warning?

> 5) We continue this somewhat-heated exchange until everybody is fed up
> with it.

The most likely outcome.

Actually, a quick grep on the man pages and include files indicates that
ssize_t isn't used much, and isn't needed much, either. Probably
syslog(2) should be returning it, but basically, it's just read and
write. Maybe printf should be returning it, but that would presumably
violate some standard that requires it to be returning an int. readv and
writev return an int, which seems completely wrong. Surely they should
return the same as read and write?

-- 
Erik Corry erik@arbat.com http://inet.uni-c.dk/~ehcorry/



More information about the Gcc mailing list