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: Freeciv-Dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: == NULL && != NULL
From: Jason Short <vze2zq63@xxxxxxxxxxx>
Date: Sun, 10 Feb 2002 06:38:31 -0500
Reply-to: jdorje@xxxxxxxxxxxx

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?
My opinions:

Changing "0" to "NULL" makes things more readible.

Changing "if (ptr)" to "if (ptr != NULL)" doesn't do anything for the code, and makes it longer as well.

Changing "0" to "FALSE" and "1" to "TRUE" makes things more readible.

Changing "int" (or whatever) to "bool[ean]" makes things much more readible.

jason



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