public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: bkoz@gcc.gnu.org
To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, kingleo@gmx.at,
	paolo@gcc.gnu.org
Subject: Re: libstdc++/5180: seekp() on fstreams opened in read only mode
Date: Mon, 08 Apr 2002 23:07:00 -0000	[thread overview]
Message-ID: <20020409060741.23909.qmail@sources.redhat.com> (raw)

Synopsis: seekp() on fstreams opened in read only mode

State-Changed-From-To: feedback->closed
State-Changed-By: bkoz
State-Changed-When: Mon Apr  8 23:07:37 2002
State-Changed-Why:
    The infinte loop is user error, I'm afraid. A better way to write that loop would be:
    
      while (in.good())
        {
          string s;
          getline(in, s);
          cout << s << endl;;
        }
    
    Anyway.
    
    This bug report actually crosses the paths of two library bugs, so this is perhaps why you might see differing interpretations of this code with other compilers and toolchains. 
    
    To wit:
    
      fstream in(name, std::ios::in);
      in.seekp(0); 
      state = in.rdstate();
    
    will give different results. I think state should be failbit, and here's why:
    
        basic_ostream::seekp(pos_type __pos)
        // DR 136
        this->rdbuf()->pubseekpos(__pos, ios_base::out);
        
    then
    
      filebuf::seekpos
      // DR 171
    
    best,
    benjamin

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5180


             reply	other threads:[~2002-04-09  6:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-08 23:07 bkoz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-12-24  1:45 paolo
2001-12-23  8:36 kingleo

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=20020409060741.23909.qmail@sources.redhat.com \
    --to=bkoz@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    --cc=gcc-gnats@gcc.gnu.org \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=kingleo@gmx.at \
    --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).