This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
RE: libstdc++/2832
- To: bkoz at gcc dot gnu dot org
- Subject: RE: libstdc++/2832
- From: "Simpson, Kenny" <Kenny dot Simpson at gs dot com>
- Date: 23 May 2001 14:36:00 -0000
- Cc: gcc-prs at gcc dot gnu dot org,
- Reply-To: "Simpson, Kenny" <Kenny dot Simpson at gs dot com>
The following reply was made to PR libstdc++/2832; it has been noted by GNATS.
From: "Simpson, Kenny" <Kenny.Simpson@gs.com>
To: "'bkoz@gcc.gnu.org'" <bkoz@gcc.gnu.org>, gcc-gnats@gcc.gnu.org,
Kenny.Simpson@gs.com, nobody@gcc.gnu.org, theonetruekenny@yahoo.com
Cc:
Subject: RE: libstdc++/2832
Date: Wed, 23 May 2001 10:32:05 -0400
I don't have a copy of the Standard in front of me, but I do have
_Standard C++ IOStreams and Locales_ by Langer and Kreft.
p72 starts with:
"rdbuf() SUBTLETIES
Note the subtle difference between a concrete stream class's rdbuf()
function and the
inherited version of rdbuf(): The inherited rdbuf() function
basic_ios<charT,
traits>::rdbuf() returns the pointer to the stream buffer that is maintained
by the
base class. The concrete stream class's rdbuf() function returns a pointer
to its contained
stream buffer object."
It goes on to include a simple example similar to the one I submitted with
the report:
"
basic_filebuf<char> buf;
buf.open("in.txt");
basic_ifstream<char> ifstr; // ifstr by default contains a file
buffer object
ifstr.basic_ios<char>::rdbuf(&buf); // here the file buffer pointer is
replaced using the
// hidden base class version of the
rdbuf() function
basic_streambuf<char>* bp;
bp = ifstr.rdbuf(); // redefined rdbuf() returns pointer to
contained, but
// unused buffer
bp = ifstr.basic_ios<char>::rdbuf(); // base class version of rdbuf()
function returns
// pointer to newly assigned and
actually used file buffer.
"
-Kenny
-----Original Message-----
From: bkoz@gcc.gnu.org [mailto:bkoz@gcc.gnu.org]
Sent: Tuesday, May 22, 2001 8:28 PM
To: bkoz@gcc.gnu.org; gcc-gnats@gcc.gnu.org; Kenny.Simpson@gs.com;
nobody@gcc.gnu.org; theonetruekenny@yahoo.com
Subject: Re: libstdc++/2832
Synopsis: rdbuf methods incorrect
Responsible-Changed-From-To: unassigned->bkoz
Responsible-Changed-By: bkoz
Responsible-Changed-When: Tue May 22 17:27:50 2001
Responsible-Changed-Why:
Responsible
State-Changed-From-To: open->analyzed
State-Changed-By: bkoz
State-Changed-When: Tue May 22 17:27:50 2001
State-Changed-Why:
This seems to be two bugs:
1) pointers returned by rdbuf() not the same
2) [io]stringstream/[io]fstream dtors delete streambuf object.
I don't see where, in the standard #1 is guaranteed. Perhaps you can
point this out to me/
I do agree that #2 is a problem, and am working on a fix now.
thanks,
benjamin
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=2832&database=gcc