[Freeciv-Dev] Re: == NULL && != NULL
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Sun, 10 Feb 2002, Raimar Falke wrote:
> No. But there are some constructs like "int c; .... if(c)" which
> bother splint. In 80% of the cases these can be replaced with "if(c >
> 0)". For example punit->fuel is tested a lot in this way. But fuel is
> an int and not a boolean.
Agreed. I always use a boolean test operator on ints. Its good for
tracking some positive/negative issues. Most of the times when comparing
ints what you really want is to use >, <, >= or <= not == or !=.
However on tests on boolean values e.g.: (a == b), (a > b), !a, and on
tests on pointer values to check if they are == NULL or != NULL, since the
tests are always on equality comparisons with 0 i don't use the extra
cruft.
I have no problem whatsoever with having a bool typedef. I usually do that
on my programs too.
---
Zen
|
|