Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2000:
[Freeciv-Dev] Re: 3 suspicous code parts
Home

[Freeciv-Dev] Re: 3 suspicous code parts

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Gaute (B) Strokkenes" <gs234@xxxxxxxxx>
Cc: Dirk Stoecker <stoecker@xxxxxxxxxxxxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: 3 suspicous code parts
From: Dirk Stoecker <stoecker@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 7 Aug 2000 10:12:50 +0200 (MET DST)

Hi,

> > server/gamehand.c lines 429 and 719:
> > %8X is used, where %X is non-standard. Only lower case %x ist standard.
> > I know at least 1 compiler, which does not support %X.
> 
> The glibc manual states that %x and %X are exactly equivalent, and
> makes no particular mention of %X being a GNU extension.  If %x is
> more portable there would be little loss in using it instead, off
> course.

Yes, you are right. I checked it in Kernighan/Ritchie book. Aynway as I
said I know one compiler which does not accept it. Maybe there was an
pre-Ansi C, which did not define %X?

> > So the compiler removes the comparison. Either it must be == (u_long) -1
> > or it has no effect:
> > 
> > warning 165 in line 193 of "server/meta.c": comparison redundant
> > because operand is unsigned
> 
> Odd.  Shouldn't -1 be converted into 0xffffffff?  This is what the
> code is meant to do, anyhow.

-1 is not 0xFFFFFFFF (at least not for all C compilers). The Motorola
CPU's and also Intel I think have different commands for signed and
unsigned comparissons. This sometimes obsoletes such checks totally, which
is normally not wanted. Most time the compiler is clever enough to fix
that, but not always :-)
In this case nothing should happen as there is only one check command
(BEQ.x) for equality checks, but who knows?

> What compiler are you using?  Is it SAS on the amiga?

SAS and vbcc. Currently the only compilers usable to compile freeciv on
Amiga. Both report that warning. I'm still trying to get more compilers
workable, but e.g. GCC fails with include problems at the moment.

Ciao
 ____  _ _  ____  _ _    _ _  ____
|    |  |  |    |  | \  / |  |    | the cool Gremlin from Bischofswerda
|  __   |   ____|  |  \/  |  |    | WWW: http://home.pages.de/~stoecker/
|    |  |  |       |      |  |    | PGP key available on www page.
|____| _|_ |____| _|_    _|_ |____| I hope AMIGA never ends to make fun!

************************************************************************
* snail-mail: Dirk Stoecker              * e-mail:                     *
*             Geschwister-Scholl-Str. 10 * stoecker@xxxxxxxxxxxxxx     *
*             01877 Bischofswerda        * phone:                      *
*             GERMANY                    * GERMANY +49 (0)3594/706666  *
************************************************************************




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