Re: Style question: comparison between signed and unsigned?

Olaf Titz (olaf@bigred.inka.de)
Tue, 23 Sep 1997 00:11:13 +0200


> What do other people feel? Should signed/unsigned conversions be
> avoided in new code? Should these be eliminated in 2.2? Will patches

They should be avoided if possible. Any mixup of signed/unsigned
integers has the potential for trouble. We've had these kinds of issue
often enough (think about the mmap() trouble when the memory layout
was changed, etc.)

Patch the code to use the right variable types. In the majority of
cases people write "int" when they really need an unsigned int.
Change some side condition and it _will_ break.

It is a "nice" experience to put certain programs through the (highly
picky and verbose) Solaris C compiler, just to see the warnings...

olaf