parts/4.5.Initialization.md

4.5 Initialization

C++ provides a number of ways that an object can be initialized, e.g.,

These many forms of initialization typically guarantee that subsequent access to the object will be well-defined. However, in some cases the value of an object can be indeterminate after its lifetime has started unless an initializer is specified, e.g., a local int variable without an initializer (see 6.22 Missing initialization of variables [LAV]).

When a function is called, each function parameter is initialized with its corresponding argument. The initialization of a function parameter, including every associated value computation and side effect, is indeterminately sequenced with respect to that of any other function parameter (see 6.24 Side-effects and Order of Evaluation of Operands [SAM]. On the other hand, the value computation and side effects of arguments in list initialization are evaluated in the order they appear from left to right.

Using the constexpr or constinit keyword when defining a variable guarantees its initialization at compile-time.