[Bug libstdc++/9925] ostrstream (buf, size) << "..." does not work properly

pinskia@physics.uc.edu gcc-bugzilla@gcc.gnu.org
Sun May 25 21:16:00 GMT 2003

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.


pinskia@physics.uc.edu changed:

           What    |Removed                     |Added
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-05-25 21:02:11
               date|                            |

------- Additional Comments From pinskia@physics.uc.edu  2003-05-25 21:02 -------
confirmed on the mainline (20030525) but had to changed the code:
#include <iostream>
#include <strstream>
using namespace std;

int main (void)
        char buf [100];

        // the following works fine in GCC 2.96 and other
        // compilers, but fails in GCC 3.1 and 3.2
        ostrstream (buf, 100) << "This is OK." << ends;
        cout << buf << endl;

        // the following works fine in any compiler
        ostrstream s (buf, 100);
        s << "This is OK." << ends;
        cout << buf << endl;

        return 0;
} /* main */

tin:~/src/gnu/gcctest>g++ pr9925.cc
In file included from /home/gates/pinskia/linux/include/c++/3.4/backward/strstream:51,
                 from pr9925.cc:2:
/home/gates/pinskia/linux/include/c++/3.4/backward/backward_warning.h:32:2: warning: 
#warning This file includes at least one deprecated or antiquated header. Please 
consider using one of the 32 headers found in section of the C++ standard. 
Examples include substituting the <X> header for the <X.h> header for C++ includes, or 
<sstream> instead of the deprecated header <strstream.h>. To disable this warning use -
./a.    tin:~/src/gnu/gcctest>./a.out 
This is OK.

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

More information about the Gcc-bugs mailing list