[Freeciv-Dev] Re: [PATCH] gotohand.c unsigned - signed clearup
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Sat, Aug 25, 2001 at 12:21:19PM +0300, Markus Linnala wrote:
>
> Clear warnings: 'comparison between signed and unsigned' at
> gotohand.c.
If we start this we may end up doing a lot of changes like this. Style
guide anyone?
Some time ago I also made everything unsigned based on the semantics
of the variable. However I read in some guide that you loose the
ability to detect underruns like in:
unsigned i=0; // i is always >=0
...
i--;
...
assert(i>0); // this won't work
and also the compiler doesn't catch cases like above although it has
been teached that i is always >=0.
However such changes may be ok for simple for loops.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"Sit, disk, sit. Good boy. Now spin up. Very good. Here's a netscape
cookie for you. Fetch me some data. Come on, you can do it. No, not that
data. Bad disk. Bad."
-- Calle Dybedahl, alt.sysadmin.recovery
|
|