Title
Effects of negative streamsize in iostreams
Status
open
Section
[input.output]
Submitter
Martin Sebor

Created on 2003-09-18.00:00:00 last changed 72 months ago

Messages

Date: 2018-12-09.12:44:26

[ Kona: The LWG agreed that this is probably what we want. However, we need a review to find all places where functions in clause 27 take arguments of type streamsize that shouldn't be allowed to go negative. Martin will do that review. ]

Date: 2018-12-09.12:44:26

Proposed resolution:

I propose that we add to each function in clause 27 that takes an argument, say N, of type streamsize a Requires clause saying that "N >= 0." The intent is to allow negative streamsize values in calls to precision() and width() but disallow it in calls to streambuf::sgetn(), istream::ignore(), or ostream::write().

Date: 2018-12-04.00:00:00

[ 2018-12-04 Reflector prioritization ]

Set Priority to 3

Date: 2018-06-22.06:38:21

[ LEWG Kona 2017 ]

Recommend Open: We agree that we should require N >= 0 for the selected functions

Date: 2010-10-21.18:28:33

[ 2009-07 Frankfurt ]

This is related to LWG 255.

Move to NAD Future.

Date: 2003-09-18.00:00:00

A third party test suite tries to exercise istream::ignore(N) with a negative value of N and expects that the implementation will treat N as if it were 0. Our implementation asserts that (N >= 0) holds and aborts the test.

I can't find anything in section 27 that prohibits such values but I don't see what the effects of such calls should be, either (this applies to a number of unformatted input functions as well as some member functions of the basic_streambuf template).

History
Date User Action Args
2018-12-09 12:44:26adminsetmessages: + msg10248
2018-06-22 06:38:21adminsetmessages: + msg9952
2018-06-22 06:38:21adminsetstatus: lewg -> open
2014-11-24 15:11:58adminsetstatus: nad future -> lewg
2010-10-21 18:28:33adminsetmessages: + msg2577
2010-10-21 18:28:33adminsetmessages: + msg2576
2010-10-21 18:28:33adminsetmessages: + msg2575
2003-09-18 00:00:00admincreate