|
919 | 919 | Certain other operations are described in this document as
|
920 | 920 | undefined behavior (for example, the effect of
|
921 | 921 | attempting to modify a const object).
|
| 922 | + |
| 923 | +\pnum |
| 924 | +\indextext{observable checkpoint} |
| 925 | +Certain events in the execution of a program |
| 926 | +are termed \defn{observable checkpoints}. |
922 | 927 | \begin{note}
|
923 |
| -This document imposes no requirements on the |
924 |
| -behavior of programs that contain undefined behavior. |
| 928 | +A call to \tcode{std::observable}\iref{utility.undefined} |
| 929 | +is an observable checkpoint. |
925 | 930 | \end{note}
|
926 | 931 |
|
927 | 932 | \pnum
|
928 | 933 | \indextext{program!well-formed}%
|
929 | 934 | \indextext{behavior!observable}%
|
| 935 | +The \defn{defined prefix} of an execution |
| 936 | +comprises the operations $O$ |
| 937 | +for which for every undefined operation $U$ |
| 938 | +there is an observable checkpoint $C$ |
| 939 | +such that $O$ happens before $C$ and |
| 940 | +$C$ happens before $U$. |
| 941 | + |
| 942 | +\begin{note} |
| 943 | +The undefined behavior that arises from a data race\iref{intro.races} |
| 944 | +occurs on all participating threads. |
| 945 | +\end{note} |
| 946 | + |
930 | 947 | A conforming implementation executing a well-formed program shall
|
931 |
| -produce the same observable behavior as one of the possible executions |
932 |
| -of the corresponding instance of the abstract machine with the |
| 948 | +produce the observable behavior |
| 949 | +of the defined prefix |
| 950 | +of one of the possible executions |
| 951 | +of the corresponding instance |
| 952 | +of the abstract machine with the |
933 | 953 | same program and the same input.
|
934 | 954 | \indextext{behavior!undefined}%
|
935 |
| -However, if any such execution contains an undefined operation, this document places no |
936 |
| -requirement on the implementation executing that program with that input |
937 |
| -(not even with regard to operations preceding the first undefined |
938 |
| -operation). |
| 955 | +If the selected execution contains an undefined operation, |
| 956 | +the implementation executing that program with that input |
| 957 | +may produce arbitrary additional observable behavior aferwards. |
939 | 958 | If the execution contains an operation specified as having erroneous behavior,
|
940 | 959 | the implementation is permitted to issue a diagnostic and
|
941 | 960 | is permitted to terminate the execution
|
|
953 | 972 |
|
954 | 973 | \pnum
|
955 | 974 | \indextext{conformance requirements}%
|
956 |
| -The least requirements on a conforming implementation are: |
| 975 | +The following specify the |
| 976 | +\defnx{observable behavior}{behavior!observable} |
| 977 | +of the program: |
957 | 978 | \begin{itemize}
|
958 | 979 | \item
|
959 | 980 | Accesses through volatile glvalues are evaluated strictly according to the
|
960 | 981 | rules of the abstract machine.
|
961 | 982 | \item
|
962 |
| -At program termination, all data written into files shall be |
963 |
| -identical to one of the possible results that execution of the program |
964 |
| -according to the abstract semantics would have produced. |
| 983 | +Data is delivered to the host environment to be written into files (\xrefc{7.21.3}). |
| 984 | + |
| 985 | +\begin{note} |
| 986 | +Delivering such data |
| 987 | +is followed by an observable checkpoint\iref{cstdio.syn}. |
| 988 | +Not all host environments provide access to file contents before program termination. |
| 989 | +\end{note} |
| 990 | + |
965 | 991 | \item
|
966 | 992 | The input and output dynamics of interactive devices shall take
|
967 | 993 | place in such a fashion that prompting output is actually delivered before a program waits for input. What constitutes an interactive device is
|
968 | 994 | \impldef{interactive device}.
|
969 | 995 | \end{itemize}
|
970 | 996 |
|
971 |
| -These collectively are referred to as the |
972 |
| -\defnx{observable behavior}{behavior!observable} of the program. |
973 | 997 | \begin{note}
|
974 | 998 | More stringent correspondences between abstract and actual
|
975 | 999 | semantics can be defined by each implementation.
|
|
0 commit comments