Commit 4f18549c authored by Robert Griesemer's avatar Robert Griesemer

clarifying ambiguity of evaluation order

R=r
DELTA=16  (0 added, 3 deleted, 13 changed)
OCL=28133
CL=28178
parent eac5db7f
...@@ -2905,21 +2905,18 @@ order. Otherwise, the order of evaluation is unspecified. ...@@ -2905,21 +2905,18 @@ order. Otherwise, the order of evaluation is unspecified.
</p> </p>
<p> <p>
For example, while evaluating the arguments for this call For example, in the assignment
to function <code>f</code>,
</p> </p>
<pre> <pre>
f(g(), h() + x[i()], <-c) y[f()], ok = g(h(), i() + x[j()], <-c), k()
</pre> </pre>
<p> <p>
the call to <code>g()</code> happens before the call to <code>h()</code>, the function calls and communication happen in the order
which happens before the call to <code>i()</code>, all of <code>f()</code>, <code>h()</code>, <code>i()</code>, <code>j()</code>,
of which happen before receiving the value from the channel <code><-c</code>, <code>g()</code>, and <code>k()</code>.
<code>c</code>. However, the order of those events compared to the evaluation
However, the order of those events compared to the evaluation of and indexing of <code>x</code> and the evaluation
<code>f</code>, the evaluation of <code>x</code>, and the indexing of <code>y</code> is not specified.
of <code>x</code> by the return value of
<code>i()</code> is not specified.
</p> </p>
<hr/> <hr/>
...@@ -3164,7 +3161,7 @@ type of a specially annotated switch expression. ...@@ -3164,7 +3161,7 @@ type of a specially annotated switch expression.
In an expression switch, In an expression switch,
the switch expression is evaluated and the switch expression is evaluated and
the case expressions, which need not be constants, the case expressions, which need not be constants,
are evaluated top-to-bottom; the first one that equals the are evaluated left-to-right and top-to-bottom; the first one that equals the
switch expression switch expression
triggers execution of the statements of the associated case; triggers execution of the statements of the associated case;
the other cases are skipped. the other cases are skipped.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment