Title
Wrong description of effect 1 of basic_istream::ignore
Status
c++14
Section
[istream.unformatted]
Submitter
Krzysztof Żelechowski

Created on 2011-09-11.00:00:00 last changed 131 months ago

Messages

Date: 2013-09-29.10:45:42

Proposed resolution:

This wording is relative to the FDIS.

Change [istream.unformatted] p25 as indicated:

basic_istream<charT,traits>&
  ignore(streamsize n = 1, int_type delim = traits::eof());

-25- Effects: Behaves as an unformatted input function (as described in [istream.unformatted], paragraph 1). After constructing a sentry object, extracts characters and discards them. Characters are extracted until any of the following occurs:

  • if n != numeric_limits<streamsize>::max() ([limits.numeric]),and n characters arehave been extracted so far
  • end-of-file occurs on the input sequence (in which case the function calls setstate(eofbit), which may throw ios_base::failure ([iostate.flags]));
  • traits::eq_int_type(traits::to_int_type(c), delim) for the next available input character c (in which case c is extracted).
Date: 2013-09-15.00:00:00

[ 2013-09-29, Chicago ]

Apply to Working Paper

Date: 2013-04-15.00:00:00

[ 2013-04-20, Bristol ]

Resolution: Ready.

Date: 2011-09-11.00:00:00

[istream.unformatted] in N3242 currently has the following to say about the semantics of basic_istream::ignore:

[..]. Characters are extracted until any of the following occurs:

  • if n != numeric_limits<streamsize>::max() (18.3.2), n characters are extracted

This statement, apart from being slightly ungrammatical, indicates that if (n == numeric_limits<streamsize>::max()), the method returns without extracting any characters.

The description intends to describe the observable behaviour of an implementation in terms of logical assertions. Logical assertions are not "bullets" that can be "entered" but need not; they are predicates that can evaluate to true or false.

The description contains two predicates, either of them causes extraction to terminate. In the incriminated case, the first predicate is evaluates to true because its premise is false, therefore no characters will be extracted.

The intended semantics would be described by the following statement:

[..]. Characters are extracted until any of the following occurs:

  • (n != numeric_limits<streamsize>::max()) (18.3.2) and (n) characters have been extracted so far.
History
Date User Action Args
2014-02-20 13:20:35adminsetstatus: wp -> c++14
2013-09-29 10:45:42adminsetmessages: + msg6655
2013-09-29 10:45:42adminsetstatus: voting -> wp
2013-09-23 13:24:31adminsetstatus: ready -> voting
2013-05-20 16:39:06adminsetmessages: + msg6513
2013-05-20 16:39:06adminsetstatus: new -> ready
2011-11-24 22:19:30adminsetmessages: + msg5902
2011-09-11 00:00:00admincreate