Section: 220.127.116.11 [structure.specifications] Status: TC1 Submitter: Judy Ward Opened: 2000-03-17 Last modified: 2016-01-28 10:19:27 UTC
Priority: Not Prioritized
View other active issues in [structure.specifications].
View all other issues in [structure.specifications].
View all issues with TC1 status.
Section 18.104.22.168 describes the basic_string::compare function this way:
22.214.171.124 - basic_string::compare [lib.string::compare] int compare(size_type pos1, size_type n1, const basic_string<charT,traits,Allocator>& str , size_type pos2 , size_type n2 ) const; -4- Returns: basic_string<charT,traits,Allocator>(*this,pos1,n1).compare( basic_string<charT,traits,Allocator>(str,pos2,n2)) .
and the constructor that's implicitly called by the above is defined to throw an out-of-range exception if pos > str.size(). See section 126.96.36.199 [string.require] paragraph 4.
On the other hand, the compare function descriptions themselves don't have "Throws: " clauses and according to 188.8.131.52, paragraph 3, elements that do not apply to a function are omitted.
So it seems there is an inconsistency in the standard -- are the "Effects" clauses correct, or are the "Throws" clauses missing?
In 184.108.40.206 [structure.specifications] paragraph 3, the footnote 148 attached to the sentence "Descriptions of function semantics contain the following elements (as appropriate):", insert the word "further" so that the foot note reads:
To save space, items that do not apply to a function are omitted. For example, if a function does not specify any further preconditions, there will be no "Requires" paragraph.
The standard is somewhat inconsistent, but a failure to note a throw condition in a throws clause does not grant permission not to throw. The inconsistent wording is in a footnote, and thus non-normative. The proposed resolution from the LWG clarifies the footnote.