tmp/tmpf4lcbf3n/{from.md → to.md}
RENAMED
|
@@ -3,57 +3,79 @@
|
|
| 3 |
The semantic descriptions in this document define a parameterized
|
| 4 |
nondeterministic abstract machine. This document places no requirement
|
| 5 |
on the structure of conforming implementations. In particular, they need
|
| 6 |
not copy or emulate the structure of the abstract machine. Rather,
|
| 7 |
conforming implementations are required to emulate (only) the observable
|
| 8 |
-
behavior of the abstract machine as explained below.[^
|
| 9 |
|
| 10 |
Certain aspects and operations of the abstract machine are described in
|
| 11 |
-
this document as implementation-defined (for example,
|
| 12 |
-
These constitute the parameters of the abstract machine.
|
| 13 |
-
implementation shall include documentation describing its
|
| 14 |
-
characteristics and behavior in these respects.[^
|
| 15 |
|
| 16 |
Such documentation shall define the instance of the abstract machine
|
| 17 |
that corresponds to that implementation (referred to as the
|
| 18 |
“corresponding instance” below).
|
| 19 |
|
| 20 |
Certain other aspects and operations of the abstract machine are
|
| 21 |
-
described in this document as unspecified (for example, order
|
| 22 |
-
evaluation of arguments in a function call [[expr.call]]). Where
|
| 23 |
possible, this document 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 |
|
| 28 |
Certain other operations are described in this document as undefined
|
| 29 |
-
(for example, the effect of attempting to modify a const
|
|
|
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
A conforming implementation executing a well-formed program shall
|
| 35 |
-
produce the
|
| 36 |
-
of the corresponding instance of the abstract
|
| 37 |
-
program and the same input.
|
| 38 |
-
undefined operation,
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
- Accesses through volatile glvalues are evaluated strictly according to
|
| 45 |
the rules of the abstract machine.
|
| 46 |
-
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
| 49 |
- The input and output dynamics of interactive devices shall take place
|
| 50 |
in such a fashion that prompting output is actually delivered before a
|
| 51 |
program waits for input. What constitutes an interactive device is
|
| 52 |
*implementation-defined*.
|
| 53 |
|
| 54 |
-
|
| 55 |
-
program.
|
| 56 |
-
|
| 57 |
-
[*Note 2*: More stringent correspondences between abstract and actual
|
| 58 |
semantics can be defined by each implementation. — *end note*]
|
| 59 |
|
|
|
|
| 3 |
The semantic descriptions in this document define a parameterized
|
| 4 |
nondeterministic abstract machine. This document places no requirement
|
| 5 |
on the structure of conforming implementations. In particular, they need
|
| 6 |
not copy or emulate the structure of the abstract machine. Rather,
|
| 7 |
conforming implementations are required to emulate (only) the observable
|
| 8 |
+
behavior of the abstract machine as explained below.[^4]
|
| 9 |
|
| 10 |
Certain aspects and operations of the abstract machine are described in
|
| 11 |
+
this document as implementation-defined behavior (for example,
|
| 12 |
+
`sizeof(int)`). These constitute the parameters of the abstract machine.
|
| 13 |
+
Each implementation shall include documentation describing its
|
| 14 |
+
characteristics and behavior in these respects.[^5]
|
| 15 |
|
| 16 |
Such documentation shall define the instance of the abstract machine
|
| 17 |
that corresponds to that implementation (referred to as the
|
| 18 |
“corresponding instance” below).
|
| 19 |
|
| 20 |
Certain other aspects and operations of the abstract machine are
|
| 21 |
+
described in this document as unspecified behavior (for example, order
|
| 22 |
+
of evaluation of arguments in a function call [[expr.call]]). Where
|
| 23 |
possible, this document 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 |
|
| 28 |
Certain other operations are described in this document as undefined
|
| 29 |
+
behavior (for example, the effect of attempting to modify a const
|
| 30 |
+
object).
|
| 31 |
|
| 32 |
+
Certain events in the execution of a program are termed
|
| 33 |
+
*observable checkpoints*.
|
| 34 |
+
|
| 35 |
+
[*Note 1*: A call to `std::observable_checkpoint` [[utility.undefined]]
|
| 36 |
+
is an observable checkpoint, as are certain parts of the evaluation of
|
| 37 |
+
contract assertions [[basic.contract]]. — *end note*]
|
| 38 |
+
|
| 39 |
+
The *defined prefix* of an execution comprises the operations O for
|
| 40 |
+
which for every undefined operation U there is an observable checkpoint
|
| 41 |
+
C such that O happens before C and C happens before U.
|
| 42 |
+
|
| 43 |
+
[*Note 2*: The undefined behavior that arises from a data race
|
| 44 |
+
[[intro.races]] occurs on all participating threads. — *end note*]
|
| 45 |
|
| 46 |
A conforming implementation executing a well-formed program shall
|
| 47 |
+
produce the observable behavior of the defined prefix of one of the
|
| 48 |
+
possible executions of the corresponding instance of the abstract
|
| 49 |
+
machine with the same program and the same input. If the selected
|
| 50 |
+
execution contains an undefined operation, the implementation executing
|
| 51 |
+
that program with that input may produce arbitrary additional observable
|
| 52 |
+
behavior afterwards. If the execution contains an operation specified as
|
| 53 |
+
having erroneous behavior, the implementation is permitted to issue a
|
| 54 |
+
diagnostic and is permitted to terminate the execution at an unspecified
|
| 55 |
+
time after that operation.
|
| 56 |
|
| 57 |
+
*Recommended practice:* An implementation should issue a diagnostic when
|
| 58 |
+
such an operation is executed.
|
| 59 |
+
|
| 60 |
+
[*Note 3*: An implementation can issue a diagnostic if it can determine
|
| 61 |
+
that erroneous behavior is reachable under an implementation-specific
|
| 62 |
+
set of assumptions about the program behavior, which can result in false
|
| 63 |
+
positives. — *end note*]
|
| 64 |
+
|
| 65 |
+
The following specify the *observable behavior* of the program:
|
| 66 |
|
| 67 |
- Accesses through volatile glvalues are evaluated strictly according to
|
| 68 |
the rules of the abstract machine.
|
| 69 |
+
- Data is delivered to the host environment to be written into files
|
| 70 |
+
(See also: ISO C 7.23.3). \[*Note 4*: Delivering such data is followed
|
| 71 |
+
by an observable checkpoint [[cstdio.syn]]. Not all host environments
|
| 72 |
+
provide access to file contents before program
|
| 73 |
+
termination. — *end note*]
|
| 74 |
- The input and output dynamics of interactive devices shall take place
|
| 75 |
in such a fashion that prompting output is actually delivered before a
|
| 76 |
program waits for input. What constitutes an interactive device is
|
| 77 |
*implementation-defined*.
|
| 78 |
|
| 79 |
+
[*Note 5*: More stringent correspondences between abstract and actual
|
|
|
|
|
|
|
|
|
|
| 80 |
semantics can be defined by each implementation. — *end note*]
|
| 81 |
|