This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[RFC] err |= ios_base::failbit or err = ios_base::failbit?!?
- From: Paolo Carlini <pcarlini at suse dot de>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Cc: Nathan Myers <ncm at cantrip dot org>
- Date: Mon, 05 Jan 2004 15:42:05 +0100
- Subject: [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.