hatcat / cg30_issues

The public issues repository for the book "Beautiful C++"
4 stars 1 forks source link

Zero initialization is only half the truth #21

Open DanielaE opened 2 years ago

DanielaE commented 2 years ago

Page 222

"If the object is of a class type ..."

The zero initialization part is correct. But if the class happens to have viable constructors, additional dynamic initialization takes place before main() which runs the constructor. Dynamic initialization may be folded into the compile-time constant initialization if the constructors in question are constexpr or consteval.