libstdc++/7989: ios::showbase doesn't work when outputting 0

Jonathan Lennox lennox@cs.columbia.edu
Fri Sep 27 08:25:00 GMT 2002


On , September 26 2002, "paolo@gcc.gnu.org" wrote to "gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, lennox@cs.columbia.edu, nobody@gcc.gnu.org, paolo@gcc.gnu.org" saying:

>     Only with gcc-3.1 the output is the same for both, that is:
>     0x5
>     0
>     In fact, the ISO/IEC Standard 14882 for C++ prescribes (22.2.2.2.2 and table 57) that the output must be identical to that obtained with the "%#x" format for the C library
>     function printf().
>     Thanks for your report, Paolo.

Ah yes, and 9899-1999 says "for x (or X) a non-zero result has 0x (or 0X)
prefixed to it."  How odd, but I agree this behavior is correct.

Thanks.

-- 
Jonathan Lennox
lennox@cs.columbia.edu



More information about the Gcc-bugs mailing list