This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: eb77.C
- To: amylaar at cygnus dot co dot uk (Joern Rennecke)
- Subject: Re: eb77.C
- From: Joe Buck <jbuck at Synopsys dot COM>
- Date: Tue, 16 Feb 99 18:39:41 PST
- Cc: oliva at dcc dot unicamp dot br, robertlipe at usa dot net, egcs at cygnus dot com
>
> > > Since the constructor for strstream is empty, this invokes undefined
> > > behaviour.
> >
> > It is not empty, and it seems to me that it should not invoke
> > undefined behavior.
>
> Look at this code from egcs/libio/strstream.h and tell be what
> strstream::strstram () does:
>
> class strstream : public strstreambase, public iostream {
> public:
> strstream() { }
> ...
> };
It first calls strstreambase::strstreambase() and then calls
iostream::iostream(). It is not empty. This is basic C++;
constructors for derived classes call those for base classes.
class strstreambase : virtual public ios {
...
protected:
strstreambuf __my_sb;
...
strstreambase() { init (&__my_sb); }
...
};