Cheers and hth. - Alf made a comment in this answer that value initialization is arguably a new feature of C++03 compared to C++98. I wonder what he meant.
Is value initialization part of C++98? Is it present in concept but not in name? Why was it added to the C++03 standard?
I have a copy of the '03 standard but not the '98 standard. Here's the definition of default initialization and value initialization.
To default-initialize an object of type T means:
— if T is a non-POD class type (clause 9), the default constructor for T is called (and the initialization is ill-formed if T has no accessible default constructor);
— if T is an array type, each element is default-initialized;
— otherwise, the object is zero-initialized.
To value-initialize an object of type T means:
— if T is a class type (clause 9) with a user-declared constructor (12.1), then the default constructor for T is called (and the initialization is ill-formed if T has no accessible default constructor);
— if T is a non-union class type without a user-declared constructor, then every non-static data member and base-class component of T is value-initialized;
— if T is an array type, then each element is value-initialized;
— otherwise, the object is zero-initialized
My guess is that '98 had default initialization but not value initialization and that there's some key difference between the two. To be honest I'm having trouble parsing the standardese here and I don't understand the difference between the definitions.
Quoting the ISO/IEC 14882:1998 standard document (that was withdrawn from ISO):
And in paragraph 7:
Details on the rationale behind the change can be found in the defect report that made it happen:
And, following that, a historical explanation: