Movatterモバイル変換


[0]ホーム

URL:



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

997. "Effects: Equivalent to" is underspecified

Section: 16.3.2.4[structure.specifications]Status:C++11Submitter: Thomas PlumOpened: 2009-03-03Last modified: 2016-01-28

Priority:Not Prioritized

View otheractive issues in [structure.specifications].

View all otherissues in [structure.specifications].

View all issues withC++11 status.

Discussion:

Addresses UK-163 [CD1]

Many functions are defined as "Effects: Equivalent to a...", which seemsto also define the preconditions, effects, etc. But this is not madeclear.

After studying the occurrences of "Effects: Equivalent to", I agree withthe diagnosis but disagree with the solution. In 27.4.3.3[string.cons]we find

14Effects: IfInputIterator is an integral type, equivalent tobasic_string(static_cast<size_type>(begin), static_cast<value_type>(end), a)

15 Otherwise constructs a string from the values in the range[begin,end), as indicated in the Sequence Requirements table (see 23.1.3).

This would be devishly difficult to re-write with an explicit"Equivalent to:" clause. Instead, I propose the following, which willresult in much less editorial re-work.

[2009-05-09 Alisdair adds:]

This issue is related to492(i).

[Batavia (2009-05):]

We agree with the proposed resolution.Move to Tentatively Ready.

Proposed resolution:

Add a new paragraph after 16.3.2.4[structure.specifications], p3:

-3- Descriptions of function semantics contain the following elements (as appropriate):154

Whenever theEffects element specifies that the semantics of somefunctionF areEquivalent to somecode-sequence, thenthe various elements are interpreted as follows. IfF'ssemantics specifies aRequires element, then that requirement islogically imposed prior to theequivalent-to semantics. Then,the semantics of thecode-sequence are determined by theRequires,Effects,Postconditions,Returns,Throws,Complexity,Remarks,ErrorConditions andNotes specified for the (one or more) functioninvocations contained in thecode-sequence. The value returned fromF is specified byF'sReturns element, orifF has noReturns element, a non-void return fromF is specified by theReturns elements incode-sequence. IfF's semantics contains aThrows (orPostconditions, orComplexity) element, then thatsupersedes any occurrences of that element in thecode-sequence.


[8]ページ先頭

©2009-2026 Movatter.jp