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

Thad P Floryan thad at cup.portal.com
Mon Jan 7 13:12:07 AEST 1991


john at chance.UUCP (John R. MacMillan) in <1991Jan5.152216.18838 at chance.UUCP>
writes:

	|	printf ("%0*.*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?

Nope.  I read the 3.51m "man" page and interpret it the same way as you.  As
mentioned in a prior posting, I've been using the K&R ("The C Programming
Language", Kernighan & Ritchie)) and the H&S ("C: A Reference Manual", Harbison
and Steele) for so long that I've come to take certain things for granted.

It's clear the 3B1's C library is simply obsolete.  Every other compiler's
runtime I've used (on other systems, even those dated prior to 3.51's 1987
date) do perform per the K&R and H&S specs.

I'm going to be "looking into" a replacement for the pertinent functions as
mentioned in the just-prior posting.

Thad Floryan [ thad at cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]



More information about the Comp.sys.att mailing list