From mboxrd@z Thu Jan 1 00:00:00 1970 From: benjamin kosnik To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org Subject: Re: libstdc++/2037 Date: Sun, 01 Apr 2001 00:00:00 -0000 Message-id: <20010312225600.4019.qmail@sourceware.cygnus.com> X-SW-Source: 2001-q1/msg02271.html List-Id: The following reply was made to PR libstdc++/2037; it has been noted by GNATS. From: benjamin kosnik To: gcc-gnats@gcc.gnu.org, georg.ritter@cern.ch, nobody@gcc.gnu.org Cc: Subject: Re: libstdc++/2037 Date: Mon, 12 Mar 2001 14:47:45 -0800 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=2037&database=gcc This is not a bug if you use stringstream and include . Your code as written does exhibit the bug, however, which makes me think this is a problem in the old strstream classes. Fixing these deprecated classes is not a priority at the moment. If you need an urgent fix to this problem, try making the following mods: // libstdc++/2037 #include #include #include #include #include using namespace std; class DataPrimitive { public: string getFormatstring() { return formatstring(); } string getHeader() { ostringstream a; a.setf( ios::right ); a << "** " << setw(15) << getFormatstring() << endl; return a.str(); } protected: virtual string formatstring() = 0; }; class integerArray : public DataPrimitive { vector*intList; public: integerArray() { intList = new vector; } ~integerArray() { delete( intList ); } void add( int value ) { intList -> push_back( value ); } string formatstring() { ostringstream a; a << "i" << 4 << endl; return a.str(); } }; int main() { integerArray a; for( int j=0; j<100; j++) a.add( -1 * j ); cout << a.getHeader() << endl; return 0; } -benjamin