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.

129. Need error indication from seekp() and seekg()

Section: 31.7.5.4[istream.unformatted], 31.7.6.2.5[ostream.seeks]Status:TC1Submitter: Angelika LangerOpened: 1999-02-22Last modified: 2016-01-28

Priority:Not Prioritized

View all otherissues in [istream.unformatted].

View all issues withTC1 status.

Discussion:

Currently, the standard does not specify how seekg() and seekp()indicate failure. They are not required to set failbit, and they can'treturn an error indication because they must return *this, i.e. thestream. Hence, it is undefined what happens if they fail. And theycan fail, for instance, when a file stream is disconnected from theunderlying file (is_open()==false) or when a wide character filestream must perform a state-dependent code conversion, etc.

The stream functions seekg() and seekp() should set failbit in thestream state in case of failure.

Proposed resolution:

Add to the Effects: clause of  seekg() in 31.7.5.4[istream.unformatted] and to the Effects: clause of seekp() in31.7.6.2.5[ostream.seeks]:

In case of failure, the function callssetstate(failbit) (which may throwios_base::failure).

Rationale:

Setting failbit is the usual error reporting mechanism for streams


[8]ページ先頭

©2009-2026 Movatter.jp