Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: == NULL && != NULL
Home

[Freeciv-Dev] Re: == NULL && != NULL

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: == NULL && != NULL
From: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Date: Sun, 10 Feb 2002 17:27:31 +0000 (WET)

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



[Prev in Thread] Current Thread [Next in Thread]