This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]