Re: Style question: comparison between signed and unsigned?
Wed, 24 Sep 1997 09:00:44 -0500 (CDT)

On Wed, 24 Sep 1997, Mike Jagdis wrote:

> On Tue, 23 Sep 1997, Theodore Y. Ts'o wrote:
> > The fact of the matter is, by having the compiler issue these warnings,
> > it makes folks much more likely to ignore *all* compiler warnings, since
> > so many of them will be false positives.
> In my experience it means that programmers start to figure C is
> so dumb they have to explicitly cast *everything* - which not
> only makes it impossible to read their code but ensures neither
> the compiler nor the human has the faintest idea whether the
> programmer *really* intended a type conversion or if there is
> a bug lurking. Not good.

Um, how is this worse then having tons of implicit and undocumented
typecasts hidden throughout the code?

Dumb programmers write dumb programs. Granted. Smart programmers take
advantage of this behavior, and only typecast when this warning comes up
and they have looked at the situation and decided yes, the conversion is
what they mean (or changed the types of other variables to the correct
type). Speaking as someone who has ported a device driver from 32 to 64
bits, this warning can be a life saver (this particular warning caught
several cases where a function wasn't prototyped, so instead of returning
an unsigned long it was being treated as returning an int, causing an
signed->unsigned conversion warning (and also causing the 32-bit value to
go from 0x80200000 (right) to 0xFFFFFFFF80200000 (wrong)). A similiar
warning caught when I was writing a 64-bit value to a 32-bit register

For those who still don't beleive, I think GCC provides a way to turn
those warnings off on the command line (-Wno-something).

> Mike

I don't speak for Bit 3.