Is cppreference.com an official page in any way that one can rely on in terms of the documentation presented there? Or should I simply read the language docs in case I need 100% certainty?
Look at this article. First, several methods of variable initialization have been listed:
Depending on context, the initializer may invoke one of the following:
- Value initialization
- Direct initialization
- Copy initialization
- List initialization
- Aggregate initialization
- Reference initialization
If no initializer is provided, the rules of default initialization apply.
The next part explains two phases of initialization for non-local variables: static and dynamic. Zero initialization happens in the static phase. It doesn't say a word when default initialization takes place though.
When you go to the description of default initialization, there's an example saying:
int n; // static non-class, a two-phase initialization is done:
// 1) zero initialization initializes n to zero
// 2) default initialization does nothing, leaving n being zero
Based on this I'd assume default initialization happens some time after zero-initialization (zero init is in the static initialization phase). But this is the only place where actually somebody mentioned when default init takes place relative to other initializations.
Is the cppreference just incomplete, or the information is there and I can't find it?