This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofTC1 status.
Section: 31.7.5.3.1[istream.formatted.reqmts]Status:TC1Submitter: Matt AusternOpened: 1998-08-03Last modified: 2016-01-28
Priority:Not Prioritized
View all otherissues in [istream.formatted.reqmts].
View all issues withTC1 status.
Discussion:
Paragraph 1 of 27.6.1.2.1 contains general requirements for allformatted input functions. Some of the functions defined in section27.6.1.2 explicitly say that those requirements apply ("Behaveslike a formatted input member (as described in 27.6.1.2.1)"), butothers don't. The question: is 27.6.1.2.1 supposed to apply toeverything in 27.6.1.2, or only to those member functions thatexplicitly say "behaves like a formatted input member"? Orto put it differently: are we to assume that everything that appearsin a section called "Formatted input functions" really is aformatted input function? I assume that 27.6.1.2.1 is intended toapply to the arithmetic extractors (27.6.1.2.2), but I assume that itis not intended to apply to extractors like
basic_istream& operator>>(basic_istream& (*pf)(basic_istream&));
and
basic_istream& operator>>(basic_streammbuf*);
There is a similar ambiguity for unformatted input, formatted output, and unformattedoutput.
Comments from Judy Ward: It seems like the problem is that thebasic_istream and basic_ostream operator <<()'s that are usedfor the manipulators and streambuf* are in the wrong section andshould have their own separate section or be modified to make it clearthat the "Common requirements" listed in section 27.6.1.2.1(for basic_istream) and section 27.6.2.5.1 (for basic_ostream) do notapply to them.
Additional comments from Dietmar Kühl: It appears to be somewhatnonsensical to consider the functions defined in [istream::extractors] paragraphs 1 to 5 to be "Formatted inputfunction" but since these functions are defined in a sectionlabeled "Formatted input functions" it is unclear to mewhether these operators are considered formatted input functions whichhave to conform to the "common requirements" from 31.7.5.3.1[istream.formatted.reqmts]: If this is the case, all manipulators, notjustws, would skip whitespace unlessnoskipws isset (... but settingnoskipws using the manipulator syntaxwould also skip whitespace :-)
It is not clear which functionsare to be considered unformatted input functions. As written, it seemsthat all functions in 31.7.5.4[istream.unformatted] are unformatted inputfunctions. However, it does not really make much sense to construct asentry object forgcount(),sync(), ... Also it isunclear what happens to thegcount() ifeg.gcount(),putback(),unget(), orsync() is called: These functions don't extract characters,some of them even "unextract" a character. Should this stillbe reflected ingcount()? Of course, it could be read as ifafter a call togcount()gcount() return0(the last unformatted input function,gcount(), didn'textract any character) and after a call toputback()gcount() returns-1 (the last unformatted inputfunctionputback() did "extract" back into thestream). Correspondingly forunget(). Is this what isintended? If so, this should be clarified. Otherwise, a correspondingclarification should be used.
Proposed resolution:
In 27.6.1.2.2 [lib.istream.formatted.arithmetic], paragraph 1.Change the beginning of the second sentence from "The conversionoccurs" to "These extractors behave as formatted input functions (asdescribed in 27.6.1.2.1). After a sentry object is constructed,the conversion occurs"
In 27.6.1.2.3, [lib.istream::extractors], before paragraph 1.Add an effects clause. "Effects: None. This extractor doesnot behave as a formatted input function (as described in27.6.1.2.1).
In 27.6.1.2.3, [lib.istream::extractors], paragraph 2. Change theeffects clause to "Effects: Calls pf(*this). This extractor does notbehave as a formatted input function (as described in 27.6.1.2.1).
In 27.6.1.2.3, [lib.istream::extractors], paragraph 4. Change theeffects clause to "Effects: Calls pf(*this). This extractor does notbehave as a formatted input function (as described in 27.6.1.2.1).
In 27.6.1.2.3, [lib.istream::extractors], paragraph 12. Change thefirst two sentences from "If sb is null, calls setstate(failbit),which may throw ios_base::failure (27.4.4.3). Extracts charactersfrom *this..." to "Behaves as a formatted input function (as describedin 27.6.1.2.1). If sb is null, calls setstate(failbit), which maythrow ios_base::failure (27.4.4.3). After a sentry object isconstructed, extracts characters from *this...".
In 27.6.1.3, [lib.istream.unformatted], before paragraph 2. Add aneffects clause. "Effects: none. This member function does not behaveas an unformatted input function (as described in 27.6.1.3, paragraph 1)."
In 27.6.1.3, [lib.istream.unformatted], paragraph 3. Change thebeginning of the first sentence of the effects clause from "Extracts acharacter" to "Behaves as an unformatted input function (as describedin 27.6.1.3, paragraph 1). After constructing a sentry object, extracts acharacter"
In 27.6.1.3, [lib.istream.unformatted], paragraph 5. Change thebeginning of the first sentence of the effects clause from "Extracts acharacter" to "Behaves as an unformatted input function (as describedin 27.6.1.3, paragraph 1). After constructing a sentry object, extracts acharacter"
In 27.6.1.3, [lib.istream.unformatted], paragraph 7. Change thebeginning of the first sentence of the effects clause from "Extractscharacters" to "Behaves as an unformatted input function (as describedin 27.6.1.3, paragraph 1). After constructing a sentry object, extractscharacters"
[No change needed in paragraph 10, because it refers to paragraph 7.]
In 27.6.1.3, [lib.istream.unformatted], paragraph 12. Change thebeginning of the first sentence of the effects clause from "Extractscharacters" to "Behaves as an unformatted input function (as describedin 27.6.1.3, paragraph 1). After constructing a sentry object, extractscharacters"
[No change needed in paragraph 15.]
In 27.6.1.3, [lib.istream.unformatted], paragraph 17. Change thebeginning of the first sentence of the effects clause from "Extractscharacters" to "Behaves as an unformatted input function (as describedin 27.6.1.3, paragraph 1). After constructing a sentry object, extractscharacters"
[No change needed in paragraph 23.]
In 27.6.1.3, [lib.istream.unformatted], paragraph 24. Change thebeginning of the first sentence of the effects clause from "Extractscharacters" to "Behaves as an unformatted input function (as describedin 27.6.1.3, paragraph 1). After constructing a sentry object, extractscharacters"
In 27.6.1.3, [lib.istream.unformatted], before paragraph 27. Add anEffects clause: "Effects: Behaves as an unformatted input function (asdescribed in 27.6.1.3, paragraph 1). After constructing a sentryobject, reads but does not extract the current input character."
In 27.6.1.3, [lib.istream.unformatted], paragraph 28. Change thefirst sentence of the Effects clause from "If !good() calls" toBehaves as an unformatted input function (as described in 27.6.1.3,paragraph 1). After constructing a sentry object, if !good() calls"
In 27.6.1.3, [lib.istream.unformatted], paragraph 30. Change thefirst sentence of the Effects clause from "If !good() calls" to"Behaves as an unformatted input function (as described in 27.6.1.3,paragraph 1). After constructing a sentry object, if !good() calls"
In 27.6.1.3, [lib.istream.unformatted], paragraph 32. Change thefirst sentence of the Effects clause from "If !good() calls..." to"Behaves as an unformatted input function (as described in 27.6.1.3,paragraph 1). After constructing a sentry object, if !good()calls..." Add a new sentence to the end of the Effects clause:"[Note: this function extracts no characters, so the value returnedby the next call to gcount() is 0.]"
In 27.6.1.3, [lib.istream.unformatted], paragraph 34. Change thefirst sentence of the Effects clause from "If !good() calls" to"Behaves as an unformatted input function (as described in 27.6.1.3,paragraph 1). After constructing a sentry object, if !good() calls".Add a new sentence to the end of the Effects clause: "[Note: thisfunction extracts no characters, so the value returned by the nextcall to gcount() is 0.]"
In 27.6.1.3, [lib.istream.unformatted], paragraph 36. Change thefirst sentence of the Effects clause from "If !rdbuf() is" to "Behavesas an unformatted input function (as described in 27.6.1.3, paragraph1), except that it does not count the number of characters extractedand does not affect the value returned by subsequent calls togcount(). After constructing a sentry object, if rdbuf() is"
In 27.6.1.3, [lib.istream.unformatted], before paragraph 37. Add anEffects clause: "Effects: Behaves as an unformatted input function (asdescribed in 27.6.1.3, paragraph 1), except that it does not count thenumber of characters extracted and does not affect the value returnedby subsequent calls to gcount()." Change the first sentence ofparagraph 37 from "if fail()" to "after constructing a sentry object,if fail()".
In 27.6.1.3, [lib.istream.unformatted], paragraph 38. Change thefirst sentence of the Effects clause from "If fail()" to "Behavesas an unformatted input function (as described in 27.6.1.3, paragraph1), except that it does not count the number of characters extractedand does not affect the value returned by subsequent calls togcount(). After constructing a sentry object, if fail()
In 27.6.1.3, [lib.istream.unformatted], paragraph 40. Change thefirst sentence of the Effects clause from "If fail()" to "Behavesas an unformatted input function (as described in 27.6.1.3, paragraph1), except that it does not count the number of characters extractedand does not affect the value returned by subsequent calls togcount(). After constructing a sentry object, if fail()
In 27.6.2.5.2 [lib.ostream.inserters.arithmetic], paragraph 1. Changethe beginning of the third sentence from "The formatting conversion"to "These extractors behave as formatted output functions (asdescribed in 27.6.2.5.1). After the sentry object is constructed, theconversion occurs".
In 27.6.2.5.3 [lib.ostream.inserters], before paragraph 1. Add aneffects clause: "Effects: None. Does not behave as a formatted outputfunction (as described in 27.6.2.5.1).".
In 27.6.2.5.3 [lib.ostream.inserters], paragraph 2. Change theeffects clause to "Effects: calls pf(*this). This extractor does notbehave as a formatted output function (as described in 27.6.2.5.1).".
In 27.6.2.5.3 [lib.ostream.inserters], paragraph 4. Change theeffects clause to "Effects: calls pf(*this). This extractor does notbehave as a formatted output function (as described in 27.6.2.5.1).".
In 27.6.2.5.3 [lib.ostream.inserters], paragraph 6. Change the firstsentence from "If sb" to "Behaves as a formatted output function (asdescribed in 27.6.2.5.1). After the sentry object is constructed, ifsb".
In 27.6.2.6 [lib.ostream.unformatted], paragraph 2. Change the firstsentence from "Inserts the character" to "Behaves as an unformattedoutput function (as described in 27.6.2.6, paragraph 1). Afterconstructing a sentry object, inserts the character".
In 27.6.2.6 [lib.ostream.unformatted], paragraph 5. Change the firstsentence from "Obtains characters" to "Behaves as an unformattedoutput function (as described in 27.6.2.6, paragraph 1). Afterconstructing a sentry object, obtains characters".
In 27.6.2.6 [lib.ostream.unformatted], paragraph 7. Add a newsentence at the end of the paragraph: "Does not behave as anunformatted output function (as described in 27.6.2.6, paragraph 1)."
Rationale:
See J16/99-0043==WG21/N1219, Proposed Resolution to Library Issue 60,by Judy Ward and Matt Austern. This proposed resolution is sectionVI of that paper.