The behavior of value-initializing an enum
1: This can be undestood like so: enum class SomeEnum : int { V1 = 0, V2 = 1, V3 = 2 }; SomeEnum a = 0; // compile error SomeEnum b = SomeEnum.V1; // OK This is basic protection from undefined behavior! 2: Yes and Yes 🙂 SomeEnum c = static_cast<SomeEnum>(1); // = SomeEnum.V2 … Read more