<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2710: "Effects: Equivalent to ..." doesn't count "Synchronization:" as determined semantics</title>
<meta property="og:title" content="Issue 2710: &quot;Effects: Equivalent to ...&quot; doesn't count &quot;Synchronization:&quot; as determined semantics">
<meta property="og:description" content="C++ library issue. Status: C++17">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2710.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#C++17">C++17</a> status.</em></p>
<h3 id="2710"><a href="lwg-defects.html#2710">2710</a>. "<i>Effects:</i> Equivalent to ..." doesn't count "<i>Synchronization:</i>" as determined semantics</h3>
<p><b>Section:</b> 16.3.2.4 <a href="https://wg21.link/structure.specifications">[structure.specifications]</a> <b>Status:</b> <a href="lwg-active.html#C++17">C++17</a>
 <b>Submitter:</b> Kazutoshi Satoda <b>Opened:</b> 2016-05-08 <b>Last modified:</b> 2017-07-30</p>
<p><b>Priority: </b>0
</p>
<p><b>View other</b> <a href="lwg-index-open.html#structure.specifications">active issues</a> in [structure.specifications].</p>
<p><b>View all other</b> <a href="lwg-index.html#structure.specifications">issues</a> in [structure.specifications].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#C++17">C++17</a> status.</p>
<p><b>Discussion:</b></p>
<p>
From N4582 17.5.1.4 [structure.specifications] p3 and p4
</p>
<blockquote>
<p>
-3- Descriptions of function semantics contain the following elements (as appropriate):
</p>
<ul>
<li><i>Requires</i>: the preconditions for calling the function</li>
<li><i>Effects</i>: the actions performed by the function</li>
<li><i>Synchronization</i>: the synchronization operations (1.10) applicable to the function</li>
<li><i>Postconditions</i>: the observable results established by the function</li>
<li><i>Returns</i>: a description of the value(s) returned by the function</li>
<li><i>Throws</i>: any exceptions thrown by the function, and the conditions that would cause the exception</li>
<li><i>Complexity</i>: the time and/or space complexity of the function</li>
<li><i>Remarks</i>: additional semantic constraints on the function</li>
<li><i>Error conditions</i>: the error conditions for error codes reported by the function.</li>
<li><i>Notes</i>: non-normative comments about the function</li>
</ul>
<p>
-4- Whenever the <i>Effects:</i> element specifies that the semantics of some function <code>F</code> are 
<em>Equivalent to</em> some code sequence, then the various elements are interpreted as follows. If 
<code>F</code>'s semantics specifies a <i>Requires:</i> element, then that requirement is logically imposed prior 
to the <em>equivalent-to</em> semantics. Next, the semantics of the code sequence are determined by the 
<i>Requires:</i>, <i>Effects:</i>, <i>Postconditions:</i>, <i>Returns:</i>, <i>Throws:</i>, <i>Complexity:</i>,
<i>Remarks:</i>, <i>Error conditions:</i>, and <i>Notes:</i> specified for the function invocations contained 
in the code sequence. The value returned from <code>F</code> is specified by <code>F</code>'s <i>Returns:</i> element, 
or if <code>F</code> has no <i>Returns:</i> element, a non-<code>void</code> return from <code>F</code> is specified by the 
<i>Returns:</i> elements in the code sequence. If <code>F</code>'s semantics contains a <i>Throws:</i>,
<i>Postconditions:</i>, or <i>Complexity:</i> element, then that supersedes any occurrences of that element in the code
sequence.
</p>
</blockquote>
<p>
The third sentence of p4 says "the semantics of the code sequence are determined
by ..." and lists all elements in p3 except "<i>Synchronization:</i>".
<p/>
I think it was just an oversight because p4 was added by library issue
<a href="lwg-defects.html#997" title="&quot;Effects: Equivalent to&quot; is underspecified (Status: C++11)">997</a><sup><a href="https://cplusplus.github.io/LWG/issue997" title="Latest snapshot">(i)</a></sup>, and its proposed resolution was drafted at the time (2009) before
"<i>Synchronization:</i>" was added into p3 for C++11.
<p/>
However, I'm not definitely sure that it is really intended and safe to
just supply "<i>Synchronization:</i>" in the list. (Could a library designer
rely on this in writing new specifications, or could someone rely on
this in writing user codes, after some years after C++11?)
</p>


<p id="res-2710"><b>Proposed resolution:</b></p>
<p>
This wording is relative to N4582.
</p>

<ol>
<li><p>Change 16.3.2.4 <a href="https://wg21.link/structure.specifications">[structure.specifications]</a> as indicated:</p>

<blockquote>
<p>
-4- Whenever the <i>Effects:</i> element specifies that the semantics of some function <code>F</code> are 
<em>Equivalent to</em> some code sequence, then the various elements are interpreted as follows. If 
<code>F</code>'s semantics specifies a <i>Requires:</i> element, then that requirement is logically imposed prior 
to the <em>equivalent-to</em> semantics. Next, the semantics of the code sequence are determined by the 
<i>Requires:</i>, <i>Effects:</i><ins>, <i>Synchronization:</i></ins>, <i>Postconditions:</i>, <i>Returns:</i>, 
<i>Throws:</i>, <i>Complexity:</i>,
<i>Remarks:</i>, <i>Error conditions:</i>, and <i>Notes:</i> specified for the function invocations contained 
in the code sequence. The value returned from <code>F</code> is specified by <code>F</code>'s <i>Returns:</i> element, 
or if <code>F</code> has no <i>Returns:</i> element, a non-<code>void</code> return from <code>F</code> is specified by the 
<i>Returns:</i> elements in the code sequence. If <code>F</code>'s semantics contains a <i>Throws:</i>,
<i>Postconditions:</i>, or <i>Complexity:</i> element, then that supersedes any occurrences of that element in the code
sequence.
</p>
</blockquote>
</li>
</ol>





</body>
</html>
