[RFC] err |= ios_base::failbit or err = ios_base::failbit?!?
Nathan Myers
ncm-nospam@cantrip.org
Mon Jan 5 22:52:00 GMT 2004
On Mon, Jan 05, 2004 at 03:37:26PM -0700, Martin Sebor wrote:
> Nathan Myers wrote:
>
> >initialization is supposed to be the
> >responsibility of the owner of the object, e.g. whoever created
> >it.
>
> Yes, I agree with this policy in general. In the case of functions
> whose performance is critical, though, it may, IMHO, be quite
> appropriate to violate it by allowing callers to pass uninitialized
> iostate by requiring the get() members to always set its value. Not
> only could it save a CPU cycle or two, but it would also make the
> get functions more robust in the presence of user errors. Unless
> you or someone else objects to a change to the text that would
> codify this policy I will write up an issue and propose that all
> facets, not just num_get, behave this way.
That would break existing user-written facets that abide by the
letter of the standard. Anyway, requiring the facet to initialize
reduces performance (if minimally). A good caller initializes his
variable anyway, so for the facet to initialize again is redundant.
The treatment of the "err" argument was meant to match that of the
C library's "errno" global -- nothing touches it unless there's an
error. I'd rather see an issue entered to say that num_get<>::get
never touches it except to assign failbit.
Nathan Myers
ncm@cantrip.org
More information about the Libstdc++
mailing list