63. Exception-handling policy for unformatted output

Section: 30.7.5.3 [ostream.unformatted] Status: TC1 Submitter: Matt Austern Opened: 1998-08-11 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [ostream.unformatted].

View all issues with TC1 status.

Discussion:

Clause 27 details an exception-handling policy for formatted input, unformatted input, and formatted output. It says nothing for unformatted output (27.6.2.6). 27.6.2.6 should either include the same kind of exception-handling policy as in the other three places, or else it should have a footnote saying that the omission is deliberate.

Proposed resolution:

In 27.6.2.6, paragraph 1, replace the last sentence ("In any case, the unformatted output function ends by destroying the sentry object, then returning the value specified for the formatted output function.") with the following text:

If an exception is thrown during output, then ios::badbit is turned on [Footnote: without causing an ios::failure to be thrown.] in *this's error state. If (exceptions() & badbit) != 0 then the exception is rethrown. In any case, the unformatted output function ends by destroying the sentry object, then, if no exception was thrown, returning the value specified for the formatted output function.

Rationale:

This exception-handling policy is consistent with that of formatted input, unformatted input, and formatted output.