public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/2037
@ 2001-03-14 14:56 bkoz
  0 siblings, 0 replies; 2+ messages in thread
From: bkoz @ 2001-03-14 14:56 UTC (permalink / raw)
  To: bkoz; +Cc: gcc-prs

The following reply was made to PR libstdc++/2037; it has been noted by GNATS.

From: bkoz@gcc.gnu.org
To: bkoz@gcc.gnu.org, gcc-gnats@gcc.gnu.org, georg.ritter@cern.ch,
  nobody@gcc.gnu.org
Cc:  
Subject: Re: libstdc++/2037
Date: 14 Mar 2001 22:53:47 -0000

 Synopsis: ostrstream, string & vector delivers 'garbage' output with cout
 
 Responsible-Changed-From-To: unassigned->bkoz
 Responsible-Changed-By: bkoz
 Responsible-Changed-When: Wed Mar 14 14:53:47 2001
 Responsible-Changed-Why:
     Responsible.
 State-Changed-From-To: open->analyzed
 State-Changed-By: bkoz
 State-Changed-When: Wed Mar 14 14:53:47 2001
 State-Changed-Why:
     only affects deprecated
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=2037&database=gcc


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: libstdc++/2037
@ 2001-04-01  0:00 benjamin kosnik
  0 siblings, 0 replies; 2+ messages in thread
From: benjamin kosnik @ 2001-04-01  0:00 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR libstdc++/2037; it has been noted by GNATS.

From: benjamin kosnik <bkoz@nabi.net>
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 <sstream>. 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 <sstream>
 #include <string>
 #include <iostream>
 #include <iomanip>
 #include <vector>
 
 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<int>*intList;
 
 public:
   integerArray() { intList = new vector<int>; }
   ~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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-04-01  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-14 14:56 libstdc++/2037 bkoz
2001-04-01  0:00 libstdc++/2037 benjamin kosnik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).