Title
array forms of unformatted input function undefined for zero-element arrays
Status
cd1
Section
[istream.unformatted]
Submitter
Martin Sebor

Created on 2006-02-23.00:00:00 last changed 163 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

I propose the following changes (references are relative to the Working Draft (document N1804).

Change 27.6.1.3, p8 (istream::get()), bullet 1 as follows:

if (n < 1) is true or (n - 1) characters are stored;

Similarly, change 27.6.1.3, p18 (istream::getline()), bullet 3 as follows:

(n < 1) is true or (n - 1) characters are stored (in which case the function calls setstate(failbit)).

Finally, change p21 as follows:

In any case, provided (n > 0) is true, it then stores a null character (using charT()) into the next successive location of the array.

Date: 2006-02-23.00:00:00

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.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg3075
2006-02-23 00:00:00admincreate