Subject: lib/22019: printf C99 conformance with %#.o
To: None <gnats-bugs@gnats.netbsd.org>
From: Johan Danielsson <joda@pdc.kth.se>
List: netbsd-bugs
Date: 06/30/2003 15:49:33
>Number:         22019
>Category:       lib
>Synopsis:       printf C99 conformance with %#.o
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 30 13:50:02 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Johan Danielsson
>Release:        NetBSD 1.6T
>Organization:
>Environment:
	<The following information is extracted from your kernel. Please>
	<append output of "ldd", "ident" where relevant (multiple lines).>
System: NetBSD blubb.pdc.kth.se 1.6T NetBSD 1.6T (BLUBB) #531: Thu May 29 13:09:25 CEST 2003 joda@blubb.pdc.kth.se:/usr/misc/src/netbsd/netbsd-cvs/src/sys/arch/i386/compile/BLUBB i386
Architecture: i386
Machine: i386
>Description:

Currently printf("%#.o", 0) produces the empty string (""), and this
is correct in terms of C89, but C99 includes this piece of text: "if
the value and precision are both 0, a single 0 is printed". This
indicates that the output should be "0".

But I'm not sure I think this makes much sense. For instance "%#.x"
would still result in "".


So either we should fix printf to comply with C99, or we should decide
that this is just rubbish. I have not seen a rationale for C99, so I
don't know why this change was made.

>How-To-Repeat:
#include <stdio.h>

main()
{
    printf("|%#.o|\n", 0);
}

>Fix:

None supplied.
>Release-Note:
>Audit-Trail:
>Unformatted:
 	<Please check that the above is correct for the bug being reported,>
 	<and append source date of snapshot, if applicable (one line).>