Movatterモバイル変換


[0]ホーム

URL:



This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofTC1 status.

22. Member open vs. flags

Section: 31.10.4.4[ifstream.members]Status:TC1Submitter: Nathan MyersOpened: 1998-08-06Last modified: 2016-01-28

Priority:Not Prioritized

View all otherissues in [ifstream.members].

View all issues withTC1 status.

Discussion:

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

Proposed resolution:

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

A successful open does not change the error state.

Rationale:

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

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


[8]ページ先頭

©2009-2026 Movatter.jp