public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Nathan Myers <ncm@cantrip.org>
To: paolo@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: libstdc++/9424: i/ostream::operator>>/<<(streambuf*) drops characters
Date: Fri, 07 Mar 2003 19:56:00 -0000	[thread overview]
Message-ID: <20030307195600.17948.qmail@sources.redhat.com> (raw)

The following reply was made to PR libstdc++/9424; it has been noted by GNATS.

From: Nathan Myers <ncm@cantrip.org>
To: libstdc++@gcc.gnu.org
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: libstdc++/9424: i/ostream::operator>>/<<(streambuf*) drops characters
Date: Fri, 7 Mar 2003 11:50:55 -0800

 On Wed, Feb 26, 2003 at 09:27:32AM -0000, P?tur Run?lfsson wrote:
 > I believe the relevant quote is in 27.6.2.5.3 p7, bullet 2:
 > 
 >   inserting in the output sequence fails (in which case the
 >   character to be inserted is not extracted);
 > 
 > So correct code is "as if":
 > 
 > int_type c = sbin->sgetc();
 > while (c != traits_type::eof())
 > {
 >   if (sbout->sputc(c) == traits_type::eof())
 >     break;
 >   c = sbin->snextc();
 > }
 > 
 > Of course, it should be OK to call sgetn if the function *knows*
 > that sputc won't fail (for example if epptr() - pptr() is big
 > enough).
 
 I wonder if this wouldn't be better implemented using sbumpc:
 
 > int_type c;
 > while ((c = sbin->sbumpc()) != traits_type::eof() &&
 >        (sbout->sputc(c) != traits_type::eof())
 >   {}
 
 I seem to recall that sbumpc() can be implemented more efficiently
 than snextc, although it's just possible I was smoking crack.
 
 Nathan Myers
 ncm-nospam@cantrip.org


             reply	other threads:[~2003-03-07 19:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-07 19:56 Nathan Myers [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-03-09 11:27 paolo
2003-03-07 21:26 Paolo Carlini
2003-02-26  9:36 Pétur Runólfsson
2003-02-26  0:34 paolo
2003-01-23 19:06 peturr02

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=20030307195600.17948.qmail@sources.redhat.com \
    --to=ncm@cantrip.org \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=paolo@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).