This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/1076: g++ 2.96 formatting doubles outputs nulls
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/1076: g++ 2.96 formatting doubles outputs nulls
- From: sullivan at mathcom dot com
- Date: 16 Dec 2000 20:44:02 -0000
- Cc: jwe at bevo dot che dot wisc dot edu, teg at redhat dot com
- Reply-To: sullivan at mathcom dot com
>Number: 1076
>Category: c++
>Synopsis: g++ 2.96 formatting doubles outputs nulls
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Dec 16 12:46:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: sullivan@mathcom.com
>Release: g++ 2.96
>Organization:
>Environment:
RedHat 7.0 on Pentium, with all update rpms as of Dec 10, 2000.
$ uname -a
Linux random 2.2.16-22enterprise #1 SMP Tue Aug 22 16:29:32 EDT 2000 i686 unknown
>Description:
g++ or glibc outputs extra null chars '\0'
when formatting doubles. Example below,
courtesy of jwe@bevo.che.wisc.edu.
>How-To-Repeat:
$ uname -a
Linux random 2.2.16-22enterprise #1 SMP Tue Aug 22 16:29:32 EDT 2000 i686 unknown
$ g++ --version
2.96
$ cat tempa.c
#include <iomanip>
#include <iostream>
int
main (void)
{
cout << setw (11) << setprecision (4);
cout.flags (ios::scientific);
cout << 1.23456789 << endl;
return 0;
}
$ g++ -o tempa tempa.c
$ ./tempa | tr '\0' X
X1.2346e+00
Note the leading X, which was a null char.
If you don't do the "tr" command, it will APPEAR to be correct,
since most terminals won't print the null.
>Fix:
None.
>Release-Note:
>Audit-Trail:
>Unformatted: