This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: libstdc++/5073: Problem with C++ style string and setw() manipulator
- From: pme at gcc dot gnu dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, tdecorte at wavesat dot com
- Date: 11 Dec 2001 16:13:45 -0000
- Subject: Re: libstdc++/5073: Problem with C++ style string and setw() manipulator
Synopsis: Problem with C++ style string and setw() manipulator
State-Changed-From-To: open->closed
State-Changed-By: pme
State-Changed-When: Tue Dec 11 08:13:44 2001
State-Changed-Why:
Thank you for your bug report.
The 2.x compilers shipped with a C++ library that was
written before the C++ standard was published. The 3.x
compilers have a new library (see gcc.gnu.org/libstdc++/
for more). With it:
13% cat 5073.cc
#include <string>
#include <iomanip>
#include <iostream>
using namespace std;
int main(void)
{
string my_str("Hello");
string my_str2("bye");
// The correct expected result was "Hello bye"
// The actual buggy result is: "Hellobye"
cout.setf(ios::left, ios::adjustfield);
cout << setw(20) << my_str << my_str2 << endl;
return 1;
}
14% g++-3.0 -Wall -W 5073.cc
15% ./a.out
Hello bye
16%
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=5073&database=gcc