Title
flush() not unformatted function
Status
cd1
Section
[ostream.unformatted]
Submitter
Martin Sebor

Created on 2006-06-14.00:00:00 last changed 172 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

I propose to revert the resolution of issue 60 with respect to flush(). Specifically, I propose to change 27.6.2.6, p7 as follows:

Effects: Behaves as an unformatted output function (as described in 27.6.2.6, paragraph 1). If rdbuf() is not a null pointer, constructs a sentry object. If this object returns true when converted to a value of type bool the function calls rdbuf()->pubsync(). If that function returns -1 calls setstate(badbit) (which may throw ios_base::failure (27.4.4.3)). Otherwise, if the sentry object returns false, does nothing.Does not behave as an unformatted output function (as described in 27.6.2.6, paragraph 1).

Date: 2006-06-14.00:00:00

The resolution of issue 60 changed basic_ostream::flush() so as not to require it to behave as an unformatted output function. That has at least two in my opinion problematic consequences:

First, flush() now calls rdbuf()->pubsync() unconditionally, without regard to the state of the stream. I can't think of any reason why flush() should behave differently from the vast majority of stream functions in this respect.

Second, flush() is not required to catch exceptions from pubsync() or set badbit in response to such events. That doesn't seem right either, as most other stream functions do so.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg3128
2006-06-14 00:00:00admincreate