public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "marc.glisse at normalesup dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/46906] istreambuf_iterator is late?
Date: Mon, 05 Sep 2011 12:39:00 -0000	[thread overview]
Message-ID: <bug-46906-4-Fd3Ox48xcr@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-46906-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #7 from Marc Glisse <marc.glisse at normalesup dot org> 2011-09-05 12:38:13 UTC ---
(In reply to comment #6)
> 1) The fact that repeated calls of operator* without intervening operator++
> calls produce the same result for a given iterator object is required by
> expression *a:
> 
> "The expression (void)*a, *a is equivalent to *a."

There are operations between the 2 calls to operator*.

> This explains the repeated values '1' and '1' from it1 and '2' and '2' from
> it2.

Oh, are you saying that this rule has priority over the one that says that
operator* just forwards to sgetc? That would actually require
istreambuf_iterator to keep the last value in cache the way libstdc++ does. If
that's the case, I believe it would be worth mentioning in the standard (it's
not just me, when I filed the bug report I had found at least one
implementation that did not cache, Roguewave (haven't checked more recent
Apache versions)).

For a vector, touching the vector between 2 dereferencing of the same iterator
invalidates the iterator. Here, my guess was that it didn't invalidate the
iterator and we should blindly call sgetc. But your explanation makes sense.


  parent reply	other threads:[~2011-09-05 12:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-12 15:26 [Bug libstdc++/46906] New: " marc.glisse at normalesup dot org
2010-12-12 17:38 ` [Bug libstdc++/46906] " paolo.carlini at oracle dot com
2010-12-12 18:01 ` marc.glisse at normalesup dot org
2010-12-12 18:28 ` paolo.carlini at oracle dot com
2011-09-05  9:49 ` daniel.kruegler at googlemail dot com
2011-09-05 10:00 ` marc.glisse at normalesup dot org
2011-09-05 11:11 ` daniel.kruegler at googlemail dot com
2011-09-05 12:39 ` marc.glisse at normalesup dot org [this message]
2011-09-05 12:57 ` daniel.kruegler at googlemail dot com
2011-09-05 14:02 ` marc.glisse at normalesup dot org
2011-09-05 14:17 ` daniel.kruegler at googlemail dot com
2011-09-05 15:06 ` marc.glisse at normalesup dot org
2012-08-22 20:00 ` glisse at gcc dot gnu.org
2023-05-17 14:46 ` redi at gcc dot gnu.org

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=bug-46906-4-Fd3Ox48xcr@http.gcc.gnu.org/bugzilla/ \
    --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).