If I have a structure with an array member, and I explicitly call the default constructor of the array in the structure’s constructor, will the elements get default-constructed? (In the case of an integer array, this would mean getting zero-initialized).
struct S
{
S() : array() {}
int array[SIZE];
};
...
S s;
// is s.array zero-initialized?
A quick test with gcc suggests that this is the case, but I wanted to confirm that I can rely on this behaviour.
(I have noticed that if I don’t explicitly default-construct the array in the structure constructor, the array elements have random values.)
Yes (highlighting mine):