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

Paolo Carlini pcarlini@suse.de
Mon Jan 5 14:42:00 GMT 2004


Hi,

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.

It's equivalent? I don't think so!

Moreover, in the implementation of __convert_to_v we have
the pattern (for doubles, f.i.):

  if (!(__err & ios_base::failbit))
    {
      char* __sanity;
      errno = 0;
      double __d = __strtod_l(__s, &__sanity, __cloc);
      if (__sanity != __s && errno != ERANGE)
        __v = __d;
      else
        __err |= ios_base::failbit;
    }

That is, besides the first issue, we also check at the outset
that the failbit is not set.

Again, I'm not at all sure that the standard prescribes this.

Thanks for any feedback,
Paolo.



More information about the Libstdc++ mailing list