§ 6.7.13.8.1 — N3220
- A function is unsequenced if it is stateless, effectless, idempotent and independent.
- A function is reproducible if it is effectless and idempotent.
- A function definition f is stateless if any definition of an object of static or thread storage duration in f or in a function that is called by f is
constbut notvolatilequalified.
- A function definition is effectless if the derived function pointer value is effectless.
- A function pointer value f is effectless if any evaluation of a function call that calls f is effectless.
- An evaluation of a function call is effectless if any store operation that is sequenced during the call is the modification of an object that synchronizes with the call; if additionally the operation is observable, there shall be a unique pointer parameter P of the function such that any access to X shall be to an lvalue that is based on P.
- A function definition is idempotent if the derived function pointer value is idempotent.
- A function pointer value f is idempotent if any evaluation of a function call that calls f is idempotent.
- An evaluation E is idempotent if a second evaluation of E can be sequenced immediately after the original one without changing the resulting value, if any, or the observable state of the execution.
- A function definition is independent if the derived function pointer value is independent.
- A function pointer value f is independent if for any object X that is observed by some call to f through an lvalue that is not based on a parameter of the call, then all accesses to X in all calls to f during the same program execution observe the same value; otherwise if the access is based on a pointer parameter, there shall be a unique such pointer parameter P such that any access to X shall be to an lvalue that is based on P.
- A store operation to an object X that is sequenced during a function call such that both synchronize is said to be observable if X is not local to the call, if the lifetime of X ends after the call, if the stored value is different from the value observed by the call, if any, and if it is the last value written before the termination of the call.
- An object X is observed by a function call if both synchronize, if X is not local to the call, if X has a lifetime that starts before the function call and if an access of X is sequenced during the call; the last value of X, if any, that is stored before the call is said to be the value of X that is observed by the call.
- An object is local to a call to a function f if its lifetime starts and ends during the call or if it is defined by f but does not escape.
- A function call and an object X synchronize if all accesses to X that are not sequenced during the call happen before or after the call.
- An object definition of an object X in a function f escapes if an access to X happens while no call to f is active.
- An operation is said to be sequenced during a function call if it is sequenced after the start of the function call and before the call terminates.
- Operations that allow to change the execution state are considered as store operations, for the purposes of these attributes.
- Operations that access the execution state, even indirectly, are considered as lvalue conversions for the purposes of these attributes.
- Execution state that is described in the library clause, such as the floating-point environment, conversion state, locale, input/output streams, external files or
errnoare considered as objects for the purposes of these attributes.
See also
unsequenced,reproducible