This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: constant signed/unsigned comparison warning


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]