Why is a POD in a struct zero-initialized by an implicit constructor when creating an object in the heap or a temporary object in the stack?
It’s expected behaviour. There are two concepts, “default initialization” and “value initialization”. If you don’t mention any initializer, the object is “default initialized”, while if you do mention it, even as () for default constructor, the object is “value initialized”. When constructor is defined, both cases call default constructor. But for built-in types, “value initialization” … Read more