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]

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


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.


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