public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: benjamin kosnik <bkoz@nabi.net>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org
Subject: Re: libstdc++/2037
Date: Sun, 01 Apr 2001 00:00:00 -0000	[thread overview]
Message-ID: <20010312225600.4019.qmail@sourceware.cygnus.com> (raw)

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


             reply	other threads:[~2001-04-01  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-01  0:00 benjamin kosnik [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-03-14 14:56 libstdc++/2037 bkoz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010312225600.4019.qmail@sourceware.cygnus.com \
    --to=bkoz@nabi.net \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).