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?!?


On Mon, Jan 05, 2004 at 01:11:49PM -0700, Martin Sebor wrote:
> Nathan Myers wrote:
> 
> ...
> >It probably would be better actually to assign failbit,  rather than
> >ORing it in. 
> 
> Perhaps. It certainly is what 22.2, p2 says, but it is contrary
> to what the individual clauses for num_get and money_get specify.

I see, it says in one place that num_get::do_get assigns goodbit, and
in another that it assigns failbit.  That's an unfortunate bit of 
"mission creep".  The original spec had them leaving it unchanged 
in the event of success, which was also consistent with 22.2p2.  

> There is no text specifying what time_get does with the iostate
> argument, so it presumably defaults to 22.2, p2, creating an
> inconsistency between how the facets report errors to callers.

A caller who passes a local variable initialized to ios_base::goodbit 
will not notice any inconsistency.  However, both are specified to
ignore the incoming state of the argument, so it's not strictly 
inconsistent.  It's just that the num_get<>::do_get members are a 
bit overactive -- or overspecified.

22.2p2, though, does reinforce that use of operator|= is not permitted.
 
> >We should check that the istream extractor code does
> >the Right Thing with error results from facet calls, and does not 
> >(e.g.) just pass the basic_ios member directly as the err argument.
> 
> You're probably thinking of passing *this as the ios_base asrgument
> (there is no conversion from ios_base to iostate).

No.  The extractors take an (inherited) basic_ios<> argument, which
(presumably) has a member of type ios_base::iostate.  I was saying 
that such a member (if any) should not be passed directly, but rather 
they should pass a properly initialized local variable.

Nathan Myers
ncm-nospam@cantrip.org


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