As-if rule
From cppreference.com
Allows any and all code transformations that do not change the observable behavior of the program.
Explanation
The C compiler is permitted to perform any changes to the program as long as the following remains true:
(until C11) | |
1) Accesses (reads and writes) to volatile objects occur strictly according to the semantics of the expressions in which they occur. In particular, they are not reordered
|
(since C11) |
2) At program termination, data written to files is exactly as if the program was executed as written.
3) Prompting text which is sent to interactive devices will be shown before the program waits for input.
4) If the pragma #pragma STDC FENV_ACCESS is supported and is set to
ON , the changes to the floating-point environment
|
(since C99) |
Notes
This section is incomplete Reason: fill out similar to cpp/language/as_if |
See also
C++ documentation for as-if rule
|