Library C++ conformance question

Martin Sebor sebor@roguewave.com
Wed Jun 14 17:54:00 GMT 2006


Steve Ellcey wrote:
> I was looking at a test case related to the get_date function in
> libstdc++ and ran into a standards question.  If you look at the
> libstdc++ test 22_locale/time_get/get_date/char/1.cc, in between calls
> to get_date, the test sets errorstate to 'good' (ios_base::goodbit).  If
> you don't do this then errorstate gets set to eofbit by some calls to
> get_date and then on the next call to get_date, if errorstate is still
> set to eofbit, the call does not do anything and the test fails.
> 
> In paragraph 2 of section 22.2 of the C++ standard it says:
> 
> 	The get() members take an ios_base::iostate& argument whose
> 	value they ignore, but set to ios_base::failbit in case of a
> 	parse error."
> 
> So, shouldn't get_date (and other get_* functions) not be looking at
> this value as it appears that they do?  And should they be setting it to
> eofbit at all, or should they just leave it as goodbit (unless a parse
> error is found)?

FWIW, I agree with your reading that the facets should ignore
the initial value of the iostate argument. As for setting eofbit,
that's now required (or will be in the next standard) -- see
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#248

Martin



More information about the Libstdc++ mailing list