This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [RFC] err |= ios_base::failbit or err = ios_base::failbit?!?
- From: Nathan Myers <ncm-nospam at cantrip dot org>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Mon, 5 Jan 2004 07:17:19 -0800
- Subject: Re: [RFC] err |= ios_base::failbit or err = ios_base::failbit?!?
- References: <3FF977BD.5080204@suse.de>
On Mon, Jan 05, 2004 at 03:42:05PM +0100, Paolo Carlini wrote:
>
> the standard, in 22.2.2.1.2, p11-12, always talks about:
>
> "... ios_base::failbit is assigned to err."
>
> On the other hand, we have been always doing:
>
> err |= ios_base::failbit.
> ...
> Again, I'm not at all sure that the standard prescribes this.
If, in every case where it prescribes assigning failbit, that point
could not be reached unless the error state was already clear, then
they are equivalent. I suspect that was the reasoning in committee.
Have you found a case where the code can set failbit but the error
state was not zero? (I.e., maybe our use of operator|= is merely
defensive coding.)
Nathan Myers
ncm-nospam@cantrip.org