Subject: Re: archive.c/arm32
To: Chris G. Demetriou <apb@iafrica.com>
From: Todd Vierling <tv@NetBSD.ORG>
List: current-users
Date: 03/24/1998 10:27:01
[Quotes from multiple people]
: > In that case, I think that
: > (int)val >= 0
: > does the right thing in every useful case:
: However, the original goal was to come up with an expression which
: yields the correct result _and_ which avoids the gcc "comparison is
: always 1 due to limited range of data type" warning.
Better: fix gcc or to be able to disable a few -W options. Then go and
remove all similar workarounds from the entire code tree.
Short-circuit math is allowed to cause warnings like this in some cases (as
a portability issue), but it should not be worked around when the
short-circuit is intended. That causes slower code at the expense of a
so-called "clean compile."
: > ((int)val >= 0) yields the correct result, but also causes that
: > warning.
:
: No, it fails in implementations that have sizeof(char) == sizeof(int).
Which is *not* an impossibility, y'know.
: > 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.
You mean "-Wall -Werror"?... As I said, fix gcc, don't borf your code
because GCC is being dain bramaged.
--
-- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com)