The C++ standard says (8.5/5):
To default-initialize an object of type
Tmeans:
If
Tis a non-POD class type (clause 9), the default constructor forTis called (and the initialization is ill-formed ifThas no accessible default constructor).If
Tis an array type, each element is default-initialized.Otherwise, the object is zero-initialized.
With this code
struct Int { int i; };
int main()
{
Int a;
}
the object a is default-initialized, but clearly a.i is not necessarily equal to 0 . Doesn't that contradict the standard, as Int is POD and is not an array ?
Edit Changed from class to struct so that Int is a POD.