[RFC] err |= ios_base::failbit or err = ios_base::failbit?!?
Nathan Myers
ncm-nospam@cantrip.org
Mon Jan 5 15:17:00 GMT 2004
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
More information about the Libstdc++
mailing list