This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: libstdc++/9439: filebuf::sputbackc ignores beginning-of-file
- From: paolo at gcc dot gnu dot org
- To: bkoz at redhat dot com, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, paolo at gcc dot gnu dot org, peturr02 at ru dot is
- Date: 2 Feb 2003 17:38:24 -0000
- Subject: Re: libstdc++/9439: filebuf::sputbackc ignores beginning-of-file
- Reply-to: paolo at gcc dot gnu dot org, bkoz at redhat dot com, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, paolo at gcc dot gnu dot org, peturr02 at ru dot is, gcc-gnats at gcc dot gnu dot org
Synopsis: filebuf::sputbackc ignores beginning-of-file
Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Sun Feb 2 17:38:23 2003
Responsible-Changed-Why:
Analyzed a bit.
State-Changed-From-To: open->feedback
State-Changed-By: paolo
State-Changed-When: Sun Feb 2 17:38:23 2003
State-Changed-Why:
Hi. I don't think there is a bug here: I cannot find in the
standard a specific prescription for the behaviour you
expect (in particular in 27.5.2.4.4) Can you?
Indeed, sputbackc calls, as expected, pbackfail, which in turns calls seekoff (fstream.tcc, line 218) (pay attention
to the preceding comment which means that this specific situation was considered and _not_ supposed to lead to an
obvious failure). The latter call then does _not_ fail and
a put back buffer is created by _M_pback_create(), hosting
the put back char, _exactly as happens_ when __testpb &&
!__testeof && !__testeq, above.
I agree that a few widespread implementations behave
differently in this case, but we are, I maintain, in the
realm of implementation defined behaviour.
Paolo.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9439