Complete.Org: Mailing Lists: Archives: freeciv-dev: September 1999:
Re: [Freeciv-Dev] Re: Merged the both tech patches a little bit
Home

Re: [Freeciv-Dev] Re: Merged the both tech patches a little bit

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: abies@xxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxxx
Subject: Re: [Freeciv-Dev] Re: Merged the both tech patches a little bit
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Wed, 8 Sep 1999 11:21:59 +1000 (EST)

Artur Biesiadowski wrote:

> > But we could have a flameware/competition about how BOOL()
> > should be defined ;-)
> > Eg,
> > #define BOOL(x) ((x) ? 1 : 0)
> > #define BOOL(x) ((x) ? TRUE : FALSE)
> > #define BOOL(x) (!!(x))
> > #define BOOL(x) (1-!(x))
> 
> And why do not use just 
> return (unit_types[id].flags & (1<<flag)) != 0;   
> ?

Ah, I knew there was some obvious idiom I was missing:
#define BOOL(x) ((x)!=0)

> BOOL seems to be a wrapper to do C-ish conversion of anything to bool -
> it defeats it's main advantage (less typing) and does not add any type
> safety.

As far as I'm concerned its not supposed to be about type safety, 
its just to have available a clear and self-documenting way of 
converting to 0 or 1, instead of having various of the above 
methods scattered through the code.

-- David

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