From Jason Turner

[intro.execution]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp084ofjv0/{from.md → to.md} +26 -16
tmp/tmp084ofjv0/{from.md → to.md} RENAMED
@@ -7,10 +7,12 @@ the block and while the block is suspended (by a call of a function,
7
  suspension of a coroutine [[expr.await]], or receipt of a signal).
8
 
9
  A *constituent expression* is defined as follows:
10
 
11
  - The constituent expression of an expression is that expression.
 
 
12
  - The constituent expressions of a *braced-init-list* or of a (possibly
13
  parenthesized) *expression-list* are the constituent expressions of
14
  the elements of the respective list.
15
  - The constituent expressions of a *brace-or-equal-initializer* of the
16
  form `=` *initializer-clause* are the constituent expressions of the
@@ -48,13 +50,20 @@ or a subexpression of an immediate subexpression of E.
48
 
49
  [*Note 1*: Expressions appearing in the *compound-statement* of a
50
  *lambda-expression* are not subexpressions of the
51
  *lambda-expression*. — *end note*]
52
 
 
 
 
 
 
 
 
53
  A *full-expression* is
54
 
55
- - an unevaluated operand [[expr.prop]],
56
  - a *constant-expression* [[expr.const]],
57
  - an immediate invocation [[expr.const]],
58
  - an *init-declarator* [[dcl.decl]] or a *mem-initializer*
59
  [[class.base.init]], including the constituent expressions of the
60
  initializer,
@@ -138,20 +147,20 @@ overlap. — *end note*]
138
  Evaluations *A* and *B* are *indeterminately sequenced* when either *A*
139
  is sequenced before *B* or *B* is sequenced before *A*, but it is
140
  unspecified which.
141
 
142
  [*Note 4*: Indeterminately sequenced evaluations cannot overlap, but
143
- either could be executed first. — *end note*]
144
 
145
  An expression *X* is said to be sequenced before an expression *Y* if
146
  every value computation and every side effect associated with the
147
  expression *X* is sequenced before every value computation and every
148
  side effect associated with the expression *Y*.
149
 
150
  Every value computation and side effect associated with a
151
  full-expression is sequenced before every value computation and side
152
- effect associated with the next full-expression to be evaluated.[^26]
153
 
154
  Except where noted, evaluations of operands of individual operators and
155
  of subexpressions of individual expressions are unsequenced.
156
 
157
  [*Note 5*: In an expression that is evaluated more than once during the
@@ -182,22 +191,23 @@ void g(int i) {
182
  }
183
  ```
184
 
185
  — *end example*]
186
 
187
- When calling a function (whether or not the function is inline), every
188
- value computation and side effect associated with any argument
189
- expression, or with the postfix expression designating the called
190
- function, is sequenced before execution of every expression or statement
191
- in the body of the called function. For each function invocation *F*,
192
- for every evaluation *A* that occurs within *F* and every evaluation *B*
193
- that does not occur within *F* but is evaluated on the same thread and
194
- as part of the same signal handler (if any), either *A* is sequenced
195
- before *B* or *B* is sequenced before *A*.[^27]
196
 
197
- [*Note 7*: If *A* and *B* would not otherwise be sequenced then they
198
- are indeterminately sequenced. *end note*]
 
199
 
200
  Several contexts in C++ cause evaluation of a function call, even though
201
  no corresponding function call syntax appears in the translation unit.
202
 
203
  [*Example 4*: Evaluation of a *new-expression* invokes one or more
@@ -206,15 +216,15 @@ example, invocation of a conversion function [[class.conv.fct]] can
206
  arise in contexts in which no function call syntax
207
  appears. — *end example*]
208
 
209
  The sequencing constraints on the execution of the called function (as
210
  described above) are features of the function calls as evaluated,
211
- whatever the syntax of the expression that calls the function might be.
212
 
213
  If a signal handler is executed as a result of a call to the
214
  `std::raise` function, then the execution of the handler is sequenced
215
  after the invocation of the `std::raise` function and before its return.
216
 
217
- [*Note 8*: When a signal is received for another reason, the execution
218
  of the signal handler is usually unsequenced with respect to the rest of
219
  the program. — *end note*]
220
 
 
7
  suspension of a coroutine [[expr.await]], or receipt of a signal).
8
 
9
  A *constituent expression* is defined as follows:
10
 
11
  - The constituent expression of an expression is that expression.
12
+ - The constituent expression of a conversion is the corresponding
13
+ implicit function call, if any, or the converted expression otherwise.
14
  - The constituent expressions of a *braced-init-list* or of a (possibly
15
  parenthesized) *expression-list* are the constituent expressions of
16
  the elements of the respective list.
17
  - The constituent expressions of a *brace-or-equal-initializer* of the
18
  form `=` *initializer-clause* are the constituent expressions of the
 
50
 
51
  [*Note 1*: Expressions appearing in the *compound-statement* of a
52
  *lambda-expression* are not subexpressions of the
53
  *lambda-expression*. — *end note*]
54
 
55
+ The *potentially-evaluated subexpressions* of an expression, conversion,
56
+ or *initializer* E are
57
+
58
+ - the constituent expressions of E and
59
+ - the subexpressions thereof that are not subexpressions of a nested
60
+ unevaluated operand [[term.unevaluated.operand]].
61
+
62
  A *full-expression* is
63
 
64
+ - an unevaluated operand [[expr.context]],
65
  - a *constant-expression* [[expr.const]],
66
  - an immediate invocation [[expr.const]],
67
  - an *init-declarator* [[dcl.decl]] or a *mem-initializer*
68
  [[class.base.init]], including the constituent expressions of the
69
  initializer,
 
147
  Evaluations *A* and *B* are *indeterminately sequenced* when either *A*
148
  is sequenced before *B* or *B* is sequenced before *A*, but it is
149
  unspecified which.
150
 
151
  [*Note 4*: Indeterminately sequenced evaluations cannot overlap, but
152
+ either can be executed first. — *end note*]
153
 
154
  An expression *X* is said to be sequenced before an expression *Y* if
155
  every value computation and every side effect associated with the
156
  expression *X* is sequenced before every value computation and every
157
  side effect associated with the expression *Y*.
158
 
159
  Every value computation and side effect associated with a
160
  full-expression is sequenced before every value computation and side
161
+ effect associated with the next full-expression to be evaluated.[^22]
162
 
163
  Except where noted, evaluations of operands of individual operators and
164
  of subexpressions of individual expressions are unsequenced.
165
 
166
  [*Note 5*: In an expression that is evaluated more than once during the
 
191
  }
192
  ```
193
 
194
  — *end example*]
195
 
196
+ When invoking a function (whether or not the function is inline), every
197
+ argument expression and the postfix expression designating the called
198
+ function are sequenced before every expression or statement in the body
199
+ of the called function. For each function invocation or evaluation of an
200
+ *await-expression* *F*, each evaluation that does not occur within *F*
201
+ but is evaluated on the same thread and as part of the same signal
202
+ handler (if any) is either sequenced before all evaluations that occur
203
+ within *F* or sequenced after all evaluations that occur within
204
+ *F*;[^23]
205
 
206
+ if *F* invokes or resumes a coroutine [[expr.await]], only evaluations
207
+ subsequent to the previous suspension (if any) and prior to the next
208
+ suspension (if any) are considered to occur within *F*.
209
 
210
  Several contexts in C++ cause evaluation of a function call, even though
211
  no corresponding function call syntax appears in the translation unit.
212
 
213
  [*Example 4*: Evaluation of a *new-expression* invokes one or more
 
216
  arise in contexts in which no function call syntax
217
  appears. — *end example*]
218
 
219
  The sequencing constraints on the execution of the called function (as
220
  described above) are features of the function calls as evaluated,
221
+ regardless of the syntax of the expression that calls the function.
222
 
223
  If a signal handler is executed as a result of a call to the
224
  `std::raise` function, then the execution of the handler is sequenced
225
  after the invocation of the `std::raise` function and before its return.
226
 
227
+ [*Note 7*: When a signal is received for another reason, the execution
228
  of the signal handler is usually unsequenced with respect to the rest of
229
  the program. — *end note*]
230