This is the mail archive of the
mailing list for the libstdc++ project.
RE: libstdc++/10093: Regression: Setting failbit in exceptions doesn't work
- From: Pétur Runólfsson <peturr02 at ru dot is>
- To: <jlquinn at optonline dot net>,"Martin Sebor" <sebor at roguewave dot com>
- Cc: <gcc-gnats at gcc dot gnu dot org>,<libstdc++ at gcc dot gnu dot org>
- Date: Mon, 24 Mar 2003 18:21:12 -0000
- Subject: RE: libstdc++/10093: Regression: Setting failbit in exceptions doesn't work
> 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.
> 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.
Just to clarify:
What I think that ios::exceptions() means (and what appears to have
been the intent, judging by some old USENET posts) is that this
should always work:
is >> x;
assert((is.exceptions() & is.rdstate()) == 0);
assert((is.exceptions() & is.rdstate()) != 0);
Likewise for ostream and for unformatted I/O functions. Also, the
value of is.rdstate() at the end of this code should not depend on
the value of is.exceptions().