This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/45628] std::fstream::tellg invalidates I/O buffer
- From: "don dot wakefield at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Sep 2010 15:15:16 -0000
- Subject: [Bug libstdc++/45628] std::fstream::tellg invalidates I/O buffer
- References: <bug-45628-18186@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #10 from don dot wakefield at gmail dot com 2010-09-10 15:15 -------
(In reply to comment #9)
> Ok. I don't think we should change the code to deal such specially with off ==
> 0, if we are going to change it we should decouple the return value from what
> the underlying seek returns, and always call fseek(..., width * off, ...) as
> the standard mandates. Then dealing with off == 0 becomes simple.
I'm not sure I understand what you are saying. My concern is that calls to
filebuf::seekoff(0,ios::cur) should not invalidate the buffer just to return a
correct answer to "where am I?". Whether this is an accident of history or not,
I've seen this usage enshrined in code as a respected idiom.
Does your text above specify this?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45628