public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "paolo dot carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/40732] fstream get/put pointers have unexpected positions
Date: Mon, 13 Jul 2009 19:59:00 -0000	[thread overview]
Message-ID: <20090713195903.18469.qmail@sourceware.org> (raw)
In-Reply-To: <bug-40732-17936@http.gcc.gnu.org/bugzilla/>



------- Comment #3 from paolo dot carlini at oracle dot com  2009-07-13 19:59 -------
The pointers are in some sense independent, but in this exact technical sense:
a seekg ends up calling the seekoff fstream virtual and therefore the mode
becomes 'uncommitted', neither read mode neither write mode. Successive writes
are therefore well defined and proceed exactly from the place where the last
read took place. Alternately, you could achieve the same net effect by stopping
reading when end of file is extracted: in C, and C++, this is a special case,
which also leads to 'uncommitted' mode, thus the following writes are well
defined - evidently in this case the user wants to append. But you can find
many testcases about all the various behaviors in the testsuite. Since this is
free software I also encourage you to browse the actual implementation: the
last special case, for example, is very clear toward the end of
basic_filebuf::underflow.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40732


      parent reply	other threads:[~2009-07-13 19:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-13 14:23 [Bug libstdc++/40732] New: " elizbus at yahoo dot com
2009-07-13 14:34 ` [Bug libstdc++/40732] " paolo dot carlini at oracle dot com
2009-07-13 17:24 ` elizbus at yahoo dot com
2009-07-13 19:59 ` paolo dot carlini at oracle dot com [this message]

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=20090713195903.18469.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).