Re: Style question: comparison between signed and unsigned?

Theodore Y. Ts'o (tytso@MIT.EDU)
Tue, 23 Sep 1997 11:44:07 -0400


Date: Mon, 22 Sep 1997 21:01:49 -0400 (EDT)
From: linux kernel account <linker@nightshade.z.ml.org>

Linus, you may be the programming God that I could never hope to be, but
I feel there is a use for that jumping-through-hoops: It encourages the
programmer to take a look at a possibly bad situation (mixing types) and
decided if the code is actually doing the right thing. Mixing types
improperly can cause bug that only show up under rare circumstances,
something the you dont want in a program... So it's good to have a sanity
check.

Sure, but then gcc should be smarter about when it isues the warnings.
I wouldn't mind so much if there was a way that you could make it shut
up for certain functions.

I dont believe that it's smarter then I and it's certantly not smarter
then you, but the compiler does read every line of code with a computers
exacting precision. Can you say you do the same? I believe it is bad to
mindlessly cast, but it is good to be asked to confirm when you do
something that could cause bad and strange problems.

The problem is that if gcc floods you with warnings, you are then asking
the user to wade through every line of warning looking for the warnings
that really indicate a problem. A lot of false positive warnings is
really bad, since people will then tend to ignore the warnings.

- Ted