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: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: == NULL && != NULL
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 10 Feb 2002 18:05:01 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Sun, Feb 10, 2002 at 04:53:04PM +0000, Vasco Alexandre Da Silva Costa wrote:
> On Sun, 10 Feb 2002, Raimar Falke wrote:
> 
> > On Sun, Feb 10, 2002 at 01:15:40AM +0000, Vasco Alexandre Da Silva Costa 
> > wrote:
> > > 
> > > Why the extra cruft?
> > 
> > For the same reason as the previous s/0/NULL/ change: to make it explicit.
> > 
> > > Is it to make the new lint happy?
> > 
> > Yes. And to allow other changes like the introduction of bool types.
> > 
> > > It isn't necessary according to the ANSI C spec.
> > 
> > Correct.
> > 
> > > Wasn't there any switch to disable it?
> > 
> > Yes there is one.
> > 
> > > I can live with it, but its annoying.
> > 
> > About bool types: I will commit today or tomorrow a patch which
> > changes 0 to FALSE and 1 to TRUE. But this will only be the first
> > step. The next step is the introduction of an type bool. Comments?
> 
> I have no problems whatsoever with switching 0 --> FALSE, 1 --> TRUE, 0
> --> NULL. I usually do that anyway.
> 
> What i dislike is the extra comparisons in the branch tests. It clutters
> them up for no valid reason IMHO. Will it also be required to change: "if
> (a > b)" to "if ((a > b) == TRUE)" ???

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.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Any sufficiently advanced technology is indistinguishable from magic."
    -- Arthur C. Clarke


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