This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.
Section: 126.96.36.199 [istream.unformatted] Status: CD1 Submitter: Martin Sebor Opened: 2006-02-23 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [istream.unformatted].
View all issues with CD1 status.
The array forms of unformatted input functions don't have well-defined semantics for zero-element arrays in a couple of cases. The affected ones (istream::get() and getline()) are supposed to terminate when (n - 1) characters are stored, which obviously can never be true when (n == 0) to start with.
I propose the following changes (references are relative to the Working Draft (document N1804).
Change 188.8.131.52, p8 (istream::get()), bullet 1 as follows:
(n - 1) characters are stored;
Similarly, change 184.108.40.206, p18 (istream::getline()), bullet 3 as follows:
(n - 1) characters are stored (in which case the function calls setstate(failbit)).
Finally, change p21 as follows:
In any case, it then stores a null character (using charT()) into the next successive location of the array.