Section: 31.7.5.3.2 [istream.formatted.arithmetic] Status: CD1 Submitter: Daniel Krügler Opened: 2007-04-01 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [istream.formatted.arithmetic].
View all issues with CD1 status.
Discussion:
To the more drastic changes of 31.7.5.3.2 [istream.formatted.arithmetic] in the current draft N2134 belong the explicit description of the extraction of the types short and int in terms of as-if code fragments.
Proposed resolution:
In 31.7.5.3.2 [istream.formatted.arithmetic]/2 change the current as-if code fragment
typedef num_get<charT,istreambuf_iterator<charT,traits> > numget; iostate err = 0; long lval; use_facet<numget>(loc).get(*this, 0, *this, err, lval ); if (err == 0) {&&if (lval < numeric_limits<short>::min() || numeric_limits<short>::max() < lval))err = ios_base::failbit; else val = static_cast<short>(lval); } setstate(err);
Similarily in 31.7.5.3.2 [istream.formatted.arithmetic]/3 change the current as-if fragment
typedef num_get<charT,istreambuf_iterator<charT,traits> > numget; iostate err = 0; long lval; use_facet<numget>(loc).get(*this, 0, *this, err, lval ); if (err == 0) {&&if (lval < numeric_limits<int>::min() || numeric_limits<int>::max() < lval))err = ios_base::failbit; else val = static_cast<int>(lval); } setstate(err);
[
Kona (2007): Note to the editor: the name lval in the call to use_facet
is incorrectly italicized in the code fragments corresponding to
operator>>(short &)
and operator >>(int &)
. Also, val -- which appears
twice on the line with the static_cast
in the proposed resolution --
should be italicized. Also, in response to part two of the issue: this
is deliberate.
]