3B1 C runtime library bug; do you have it too?

John R. MacMillan john at chance.UUCP
Sun Jan 6 02:22:16 AEST 1991


|All 3B1 systems I have here (with 3.5 & 3.5 dev. set and 3.51m w/3.51 dev set)
|produce the (incorrect) results:
|
|		*.*f
|		 1.230

I'm not convinced these are incorrect results...

|main()
|{
|	int p = 3;
|	double frac = 1.23;
|
|	printf ("%0*.*f\n", p+3, p, frac);
                  ^
|	printf ("%*.*f\n",  p+3, p, frac);
|}

The printf(3) man page says the spec is "...the character %...zero
or more flags...an optional decimal digit specifying minimum field
width...a period followed by a decimal digit", and "a field width or
precision may be indicated by an asterisk instead of a digit string"

Now the '0' after the '%' above is not one of the listed flag chars,
but the '*' is only acceptable *instead of* a field width.  So I'd
say that by the 3.51 man page I have, the specification is illegal.

Am I missing something?
-- 
John R. MacMillan       | I wish I had a nickname like Crusher, Snake or Dennis
john at chance.UUCP        | Because guys with nicknames always get the gal.
...!scocan!chance!john  |       -- barenaked ladies



More information about the Comp.sys.att mailing list