Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: Profiling Civserver again
Home

[Freeciv-Dev] Re: Profiling Civserver again

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Cc: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Profiling Civserver again
From: Jules Bean <jules@xxxxxxxxxxxxxxx>
Date: Thu, 2 Aug 2001 12:43:45 +0100

On Thu, Aug 02, 2001 at 04:06:18AM +0100, Vasco Alexandre Da Silva Costa wrote:
> On Wed, 1 Aug 2001, Ross W. Wetmore wrote:
> 
> > It is also unsafe. Boolean TRUE values are undefined by the standards, and 
> > there is no guarantee that this is not represented by any non-zero set of
> > bits. You need to do this as (X >= 0 ? 1 : 0) to be 100% safe.
> 
> Please read ANSI X3.159-1989 section 3.3.8.
> I get sad each time i see people busting their finges typing such futile
> monstruosities as you typed above (they even make the code more

What a strange stance.  

You think relying on the type coercion rules of C is a good technique
to make code clear?  Surely not! I'll grant you that many shorthands
are convenient, but they certainly don't make the code more clear.

Consider someone with their background in some (any) other language.
They may be pretty unsure about the implicit conversions from boolean
to int. (False --> 0 is a fairly natural guess, but true could easily
be represented by -1, IMO).

(X>=0 ? 1 : 0) makes it totally clear (as long as they know the ?
operator, of course!)

Jules


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