This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: goodbit and zero as ios_base::iostate values
- From: "gp" <cpp_lists at libero dot it>
- To: "Jorma Laaksonen" <jorma dot laaksonen at hut dot fi>
- Cc: <libstdc++ at gcc dot gnu dot org>
- Date: Wed, 6 Nov 2002 19:12:32 +0100
- Subject: Re: goodbit and zero as ios_base::iostate values
- References: <1036592646.8858.ezmlm@gcc.gnu.org> <x4heeuwyva.fsf@james.hut.fi>
> Hello!
Hi! :-)
[...]
> it contains the line
>
> ios_base::iostate err = 0;
That's not required to work, so there's an error in the standard.
> which doesn't compile with g++ 3.2 because it says:
>
> invalid conversion from `int' to `std::_Ios_Iostate'
With the libstdc++ implementation the error message is correct.
> Also [lib.istream.formatted.arithmetic] contains a code fragment where
>
> iostate err = 0;
>
> ios_base::iostate is of [lib.bitmask.types] bitmask type and it seems to
me
> that the Standard doesn't there say anything about from int to bitmask
> conversion nor about initialization from int.
You are correct. They should have written
ios_base::iostate err= ios_base::goodbit;
> However, [lib.ios::iostate] first tells about the three elements
> badbit, eofbit and failbit, and then mentions that:
>
> Type iostate also defines the constant:
> - goodbit, the value zero.
I think a DR is in order here. Actually what is meant is "iostate()", i.e.
the value obtained with value-initialization. See 5.2.3/2 (with the
corrections of core issue 178) and, for the case where iostate is a bitset,
23.3.5.1
Why don't you submit it to comp.std.c++?
>
> I cannot judge from these two code excerpts and the vague mention of
> zero value, whether the libstdc++ implementation is conformant or not.
As far as iostate is concerned it is conforming, as you may see from
17.3.2.1.2.
Genny.