Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Jan 1998 16:18:03 -0500 (EST)
From:      Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To:        Terry Lambert <tlambert@primenet.com>
Cc:        ache@nagual.pp.ru (=?KOI8-R?B?4c7E0sXKIP7F0s7P1w==?=), current@FreeBSD.ORG
Subject:   Re: Nasty GCC bug?
Message-ID:  <199801202118.QAA14891@khavrinen.lcs.mit.edu>
In-Reply-To: <199801202053.NAA25835@usr06.primenet.com>
References:  <Pine.BSF.3.96.980120224412.28008A-100000@lsd.relcom.eu.net> <199801202053.NAA25835@usr06.primenet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
<<On Tue, 20 Jan 1998 20:53:41 +0000 (GMT), Terry Lambert <tlambert@primenet.com> said:

> Also, my field width limits are being ignored.  I kind of expected
> it to print out a field limit's worth of hex characters, starting at
> the lsb.

No.

>From printf(3):

     o   An optional decimal digit string specifying a minimum field width.
         If the converted value has fewer characters than the field width, it
         will be padded with spaces on the left (or right, if the left-adjust-
         ment flag has been given) to fill out the field width.

What you wanted is not available in the standard printf(3) model,
since the precision means something else:

     o   An optional precision, in the form of a period `.' followed by an op-
         tional digit string.  If the digit string is omitted, the precision
         is taken as zero.  This gives the minimum number of digits to appear
         for d, i, o, u, x, and X conversions, the number of digits to appear
         after the decimal-point for e, E, and f conversions, the maximum num-
         ber of significant digits for g and G conversions, or the maximum
         number of characters to be printed from a string for s conversions.

One might wish that the precision for %d meant the same thing as for
%s, which is what you want, but it doesn't.

-GAWollman

--
Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same
wollman@lcs.mit.edu  | O Siem / The fires of freedom 
Opinions not those of| Dance in the burning flame
MIT, LCS, CRS, or NSA|                     - Susan Aglukark and Chad Irschick



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801202118.QAA14891>