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: Jules Bean <jules@xxxxxxxxxxxxxxx>
Cc: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>, "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Profiling Civserver again
From: Gaute B Strokkenes <gs234@xxxxxxxxx>
Date: Tue, 07 Aug 2001 03:37:12 +0200

On Thu, 2 Aug 2001, jules@xxxxxxxxxxxxxxx wrote:
> 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.

These aren't the type coercion rules.

Personally, I belive that in cases like these it is best to use `if
(fubar)' iff fubar can reasonably be interpreted as a truth value, and
`if (fubar != 0)' otherwise.  For instance, I don't like `if
(x_coordinate)' and suchlike.

> 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).

If anyone knows _that_ little about C, then they shouldn't be using
it.  A little knowledge is a dangerous thing...

-- 
Big Gaute                               http://www.srcf.ucam.org/~gs234/
Is there something I should be DOING with a GLAZED DONUT??


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