tmp/tmp2wl2_m81/{from.md → to.md}
RENAMED
|
@@ -16,11 +16,12 @@ characteristics and behavior in these respects.[^6] Such documentation
|
|
| 16 |
shall define the instance of the abstract machine that corresponds to
|
| 17 |
that implementation (referred to as the “corresponding instance” below).
|
| 18 |
|
| 19 |
Certain other aspects and operations of the abstract machine are
|
| 20 |
described in this International Standard as unspecified (for example,
|
| 21 |
-
|
|
|
|
| 22 |
International Standard defines a set of allowable behaviors. These
|
| 23 |
define the nondeterministic aspects of the abstract machine. An instance
|
| 24 |
of the abstract machine can thus have more than one possible execution
|
| 25 |
for a given program and a given input.
|
| 26 |
|
|
@@ -35,19 +36,15 @@ of the corresponding instance of the abstract machine with the same
|
|
| 35 |
program and the same input. However, if any such execution contains an
|
| 36 |
undefined operation, this International Standard places no requirement
|
| 37 |
on the implementation executing that program with that input (not even
|
| 38 |
with regard to operations preceding the first undefined operation).
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
are unspecified during the execution of the signal handler, and the
|
| 47 |
-
value of any object not in either of these two categories that is
|
| 48 |
-
modified by the handler becomes undefined.
|
| 49 |
|
| 50 |
An instance of each object with automatic storage duration (
|
| 51 |
[[basic.stc.auto]]) is associated with each entry into its block. Such
|
| 52 |
an object exists and retains its last-stored value during the execution
|
| 53 |
of the block and while the block is suspended (by a call of a function
|
|
@@ -115,18 +112,20 @@ or -17 and 12. However on a machine in which overflows do not produce an
|
|
| 115 |
exception and in which the results of overflows are reversible, the
|
| 116 |
above expression statement can be rewritten by the implementation in any
|
| 117 |
of the above ways because the same result will occur.
|
| 118 |
|
| 119 |
A *full-expression* is an expression that is not a subexpression of
|
| 120 |
-
another expression.
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
call
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
|
|
|
|
|
|
| 128 |
|
| 129 |
``` cpp
|
| 130 |
struct S {
|
| 131 |
S(int i): I(i) { }
|
| 132 |
int& v() { return I; }
|
|
@@ -177,22 +176,25 @@ sequenced* when either *A* is sequenced before *B* or *B* is sequenced
|
|
| 177 |
before *A*, but it is unspecified which. Indeterminately sequenced
|
| 178 |
evaluations cannot overlap, but either could be executed first.
|
| 179 |
|
| 180 |
Every value computation and side effect associated with a
|
| 181 |
full-expression is sequenced before every value computation and side
|
| 182 |
-
effect associated with the next full-expression to be evaluated.[^8]
|
| 183 |
|
| 184 |
Except where noted, evaluations of operands of individual operators and
|
| 185 |
of subexpressions of individual expressions are unsequenced. In an
|
| 186 |
expression that is evaluated more than once during the execution of a
|
| 187 |
program, unsequenced and indeterminately sequenced evaluations of its
|
| 188 |
subexpressions need not be performed consistently in different
|
| 189 |
evaluations. The value computations of the operands of an operator are
|
| 190 |
sequenced before the value computation of the result of the operator. If
|
| 191 |
a side effect on a scalar object is unsequenced relative to either
|
| 192 |
another side effect on the same scalar object or a value computation
|
| 193 |
-
using the value of the same scalar object,
|
|
|
|
|
|
|
|
|
|
| 194 |
|
| 195 |
``` cpp
|
| 196 |
void f(int, int);
|
| 197 |
void g(int i, int* v) {
|
| 198 |
i = v[i++]; // the behavior is undefined
|
|
|
|
| 16 |
shall define the instance of the abstract machine that corresponds to
|
| 17 |
that implementation (referred to as the “corresponding instance” below).
|
| 18 |
|
| 19 |
Certain other aspects and operations of the abstract machine are
|
| 20 |
described in this International Standard as unspecified (for example,
|
| 21 |
+
evaluation of expressions in a *new-initializer* if the allocation
|
| 22 |
+
function fails to allocate memory ([[expr.new]])). Where possible, this
|
| 23 |
International Standard defines a set of allowable behaviors. These
|
| 24 |
define the nondeterministic aspects of the abstract machine. An instance
|
| 25 |
of the abstract machine can thus have more than one possible execution
|
| 26 |
for a given program and a given input.
|
| 27 |
|
|
|
|
| 36 |
program and the same input. However, if any such execution contains an
|
| 37 |
undefined operation, this International Standard places no requirement
|
| 38 |
on the implementation executing that program with that input (not even
|
| 39 |
with regard to operations preceding the first undefined operation).
|
| 40 |
|
| 41 |
+
If a signal handler is executed as a result of a call to the `raise`
|
| 42 |
+
function, then the execution of the handler is sequenced after the
|
| 43 |
+
invocation of the `raise` function and before its return. When a signal
|
| 44 |
+
is received for another reason, the execution of the signal handler is
|
| 45 |
+
usually unsequenced with respect to the rest of the program.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
An instance of each object with automatic storage duration (
|
| 48 |
[[basic.stc.auto]]) is associated with each entry into its block. Such
|
| 49 |
an object exists and retains its last-stored value during the execution
|
| 50 |
of the block and while the block is suspended (by a call of a function
|
|
|
|
| 112 |
exception and in which the results of overflows are reversible, the
|
| 113 |
above expression statement can be rewritten by the implementation in any
|
| 114 |
of the above ways because the same result will occur.
|
| 115 |
|
| 116 |
A *full-expression* is an expression that is not a subexpression of
|
| 117 |
+
another expression. in some contexts, such as unevaluated operands, a
|
| 118 |
+
syntactic subexpression is considered a full-expression (Clause
|
| 119 |
+
[[expr]]). If a language construct is defined to produce an implicit
|
| 120 |
+
call of a function, a use of the language construct is considered to be
|
| 121 |
+
an expression for the purposes of this definition. A call to a
|
| 122 |
+
destructor generated at the end of the lifetime of an object other than
|
| 123 |
+
a temporary object is an implicit full-expression. Conversions applied
|
| 124 |
+
to the result of an expression in order to satisfy the requirements of
|
| 125 |
+
the language construct in which the expression appears are also
|
| 126 |
+
considered to be part of the full-expression.
|
| 127 |
|
| 128 |
``` cpp
|
| 129 |
struct S {
|
| 130 |
S(int i): I(i) { }
|
| 131 |
int& v() { return I; }
|
|
|
|
| 176 |
before *A*, but it is unspecified which. Indeterminately sequenced
|
| 177 |
evaluations cannot overlap, but either could be executed first.
|
| 178 |
|
| 179 |
Every value computation and side effect associated with a
|
| 180 |
full-expression is sequenced before every value computation and side
|
| 181 |
+
effect associated with the next full-expression to be evaluated.[^8]
|
| 182 |
|
| 183 |
Except where noted, evaluations of operands of individual operators and
|
| 184 |
of subexpressions of individual expressions are unsequenced. In an
|
| 185 |
expression that is evaluated more than once during the execution of a
|
| 186 |
program, unsequenced and indeterminately sequenced evaluations of its
|
| 187 |
subexpressions need not be performed consistently in different
|
| 188 |
evaluations. The value computations of the operands of an operator are
|
| 189 |
sequenced before the value computation of the result of the operator. If
|
| 190 |
a side effect on a scalar object is unsequenced relative to either
|
| 191 |
another side effect on the same scalar object or a value computation
|
| 192 |
+
using the value of the same scalar object, and they are not potentially
|
| 193 |
+
concurrent ([[intro.multithread]]), the behavior is undefined. The next
|
| 194 |
+
section imposes similar, but more complex restrictions on potentially
|
| 195 |
+
concurrent computations.
|
| 196 |
|
| 197 |
``` cpp
|
| 198 |
void f(int, int);
|
| 199 |
void g(int i, int* v) {
|
| 200 |
i = v[i++]; // the behavior is undefined
|