Side effects in dynamic/static initialization
Section [basic.start.static]
Daniel Kr├╝gler

Created on 2011-04-08.00:00:00 last changed 2 weeks ago


Date: 2022-11-20.07:54:16

CWG 2022-11-11

The precise normative identification of side effects relevant for the rule remains open. An approach similar to the constexpr model of considering the transitive hull of evaluations might be applicable.

Date: 2016-02-15.00:00:00

According to [basic.start.static] paragraph 3,

An implementation is permitted to perform the initialization of a non-local variable with static storage duration as a static initialization even if such initialization is not required to be done statically, provided that

  • the dynamic version of the initialization does not change the value of any other object of namespace scope prior to its initialization, and

  • the static version of the initialization produces the same value in the initialized variable as would be produced by the dynamic initialization if all variables not required to be initialized statically were initialized dynamically.

This does not consider side effects of the initialization in this determination, only the values of namespace-scope variables.

Date User Action Args
2022-11-20 07:54:16adminsetmessages: + msg7028
2022-02-18 07:47:23adminsetstatus: drafting -> open
2011-04-08 00:00:00admincreate