Title
Member open vs. flags
Status
tc1
Section
[ifstream.members]
Submitter
Nathan Myers

Created on 1998-08-06.00:00:00 last changed 164 months ago

Messages

Date: 2010-10-21.18:28:33

Rationale:

This may seem surprising to some users, but it's just an instance of a general rule: error flags are never cleared by the implementation. The only way error flags are are ever cleared is if the user explicitly clears them by hand.

The LWG believed that preserving this general rule was important enough so that an exception shouldn't be made just for this one case. The resolution of this issue clarifies what the LWG believes to have been the original intent.

Date: 2010-10-21.18:28:33

Proposed resolution:

In [ifstream.members] paragraph 3, and in [ofstream.members] paragraph 3, under open() effects, add a footnote:

A successful open does not change the error state.

Date: 1998-08-06.00:00:00

The description of basic_istream<>::open leaves unanswered questions about how it responds to or changes flags in the error status for the stream. A strict reading indicates that it ignores the bits and does not change them, which confuses users who do not expect eofbit and failbit to remain set after a successful open. There are three reasonable resolutions: 1) status quo 2) fail if fail(), ignore eofbit 3) clear failbit and eofbit on call to open().

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg51
2010-10-21 18:28:33adminsetmessages: + msg50
1998-08-06 00:00:00admincreate