public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Martin Sebor <sebor@roguewave.com> To: jlquinn@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: libstdc++/10093: Regression: Setting failbit in exceptions doesn't work Date: Wed, 26 Mar 2003 02:56:00 -0000 [thread overview] Message-ID: <20030326023601.19659.qmail@sources.redhat.com> (raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 2735 bytes --] The following reply was made to PR libstdc++/10093; it has been noted by GNATS. From: Martin Sebor <sebor@roguewave.com> To: gcc-gnats@gcc.gnu.org Cc: Subject: Re: libstdc++/10093: Regression: Setting failbit in exceptions doesn't work Date: Tue, 25 Mar 2003 19:29:23 -0700 Pétur Runólfsson wrote: > ... > Do you mean that "these called functions" in p4 only refers to > rdbuf()->sbumpc() and rdbuf()->sgetc() and not setstate()? Yes, that's how I read it. > > The part "as if the called function had returned a failure > indication" implies that setstate is not included (after all, it > doesn't return failure indications), but the part "If badbit is > on in exceptions(), [...], otherwise it does not throw anything" > implies that s >> x will only throw if > (s.exceptions() & ios::badbit) != 0, so setstate should be > included (but this contradicts the resolution to DR 64). I'm not sure I follow you here. Are you concerned that the text contradicts itself in that if badbit is not set in exceptions but failbit is, calling setstate (failbit) is not allowed to throw failure? I don't think that is the intent of the text. > ... >> > IMO, stream members should consistently catch all >> > exceptions from any functions they may call. >>I buy this :-) > > > I agree, however I also think that exceptions() should be consistent > with itself, that is, setting exceptions(foobit) should simply mean > that whenever foobit is set in rdstate(), an exception is thrown. I agree. > In the current implementation (and to some extent, the standard) > the effect of exceptions(foobit) differs between the various I/O > functions and depends on the value of foobit. I'm not too familiar with the libstdc++ implementation so I can't speak for it but I can't think of any place in the standard that mandates or allows this behavior. Do you have an example? > ... > [1] Actually, the resolution talks about exceptions thrown "while > extracting characters from sb" which seems rather silly as the > function extracts characters from rdbuf() and inserts them into > sb. That looks like a typo in the resolution. I would expect the function to behave as if the text read: If the function inserts no characters, it calls setstate (failbit), which may throw ios_base::failure (27.4.4.3). If the function caught an exception thrown while inserting characters into *sb then if failbit is on in exceptions() (27.4.4.3), failbit is set in *this without throwing ios_base::failure and the caught exception is rethrown; otherwise the function calls setstate(failbit), which may throw ios_base::failure (27.4.4.3). Martin
next reply other threads:[~2003-03-26 2:36 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-03-26 2:56 Martin Sebor [this message] -- strict thread matches above, loose matches on Subject: below -- 2003-03-24 18:26 Pétur Runólfsson 2003-03-24 11:09 Pétur Runólfsson 2003-03-23 20:30 Martin Sebor 2003-03-23 19:26 Pétur Runólfsson 2003-03-23 6:56 Jerry Quinn 2003-03-22 15:22 paolo 2003-03-15 10:36 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=20030326023601.19659.qmail@sources.redhat.com \ --to=sebor@roguewave.com \ --cc=gcc-prs@gcc.gnu.org \ --cc=jlquinn@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: linkBe 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).