Subject: Re: archive.c/arm32
To: None <cgd@pa.dec.com, jfw@jfwhome.funhouse.com>
From: Wolfgang Solfrank <ws@tools.de>
List: current-users
Date: 03/24/1998 14:48:31
> > ((int)val >= 0) yields the correct result, but also causes that
> > warning.
> 
> a-HA.  Granted, a compiler is entitled to emit as many spurious messages
> as it likes, but this seems too clever by half...

That's why I really don't like the religious requirement of -Wall in our
compilation.

GCC tries to be clever to warn people about things that might be considered
established idioms in C, (in contrast to lint) doesn't allow turning off
its warnings (so you have to write silly constructs to work around these
warnings), and even does a half-assed job on it (like Chris' workaround
below shows; would gcc do this warning job right, it would have to spew
the warning there, too).

So:

> > (((int)val & 0x100) == 0) also yields the correct result (for machines
> > where char is 8 bits -- i.e. all machines that NetBSD supports), but
> > does not cause that warning.  The expression is still always true on
> > unsigned-char machines, but gcc isn't sophisticated enough to catch it.
>                                         ^^^^^^^^^^^^^
> To quote Rob Pike, "The technical term for that is ``brain damaged''."

Yes, in a word, this GCC warning features (despite the fact that they might
uncover some bugs) _is_ _brain damaged_.

Ciao,
Wolfgang
-- 
ws@TooLs.DE     (Wolfgang Solfrank, TooLs GmbH) 	+49-228-985800