This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++14 status.

2085. Wrong description of effect 1 of basic_istream::ignore

Section: [istream.unformatted] Status: C++14 Submitter: Krzysztof Żelechowski Opened: 2011-09-11 Last modified: 2016-12-23

Priority: Not Prioritized

View all other issues in [istream.unformatted].

View all issues with C++14 status.

Discussion: [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:

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:

[2013-04-20, Bristol]

Resolution: Ready.

[2013-09-29, Chicago]

Apply to Working Paper

Proposed resolution:

This wording is relative to the FDIS.

Change [istream.unformatted] p25 as indicated:

  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: