This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] err |= ios_base::failbit or err = ios_base::failbit?!?


Nathan Myers wrote:

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.)

Well this is the sequence of calls:


get -> do_get -> _M_extract_int(float)

the latter contains the |= and nothing in the middle in our implementation,
(neither in 22.2.2.1.2) changes the err passed by get.

Therefore, it looks like we have *plenty* of cases!!!

Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]