Below is from cppref of Designated initializers:
struct A { int x; int y; int z; };
A b{.x = 1, .z = 2}; // ok, b.y initialized to 0
By default, all fundamental types are default-initialized rather than zero-initialized in C++.
Why do designated initializers zero-initialize the data members?
b.y
will be initialized from an empty initializer list, as the effect, zero-initialized to0
.From the standard, [dcl.init.aggr]/5: