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: Todd Goodman <tsg@xxxxxxxxxxxxx>
Date: Mon, 7 Aug 2000 09:34:21 -0400

* Gaute (B) Strokkenes <gs234@xxxxxxxxx> [000806 15:25]:
> Dirk Stoecker <stoecker@xxxxxxxxxxxxxxxxxxxxx> writes:
> 
> > Hi,
> > 
> > the source has some suspicous format strings:
> > 
> > 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.

They aren't equivalent on all the systems I've used.  %X displays the
hex character A-F as uppercase and %x displays them as lowercase.

This is the case in the C draft standard that I have access to as well
(p. 261, 7.9.16.1, WG14/N843 Comittee Draft, August 3, 1998).

> 
> > clients/options.c lines 272 and 314:
> > %2.2d is used, but %d does not support anything with '.'. It is integer
> > an not floating point.
> 
> I've no idea.

The '.' is supported for d, i, o, u, x, X, a, A, e, E, f, F, g, G, and s
conversions according to the same draft (and my Solaris man pages).

It is an optional precision which is the minimum number of digits to
appear for the d, i, o, u, x, and X conversions.

It's different from the field width (the number between '%' and '.') in
that field width allows left or right justification and space pads.

Todd



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