Lightning Talk: So You Thought C++ Was Weird? Meet Enums
summary
C++ enums are just named integers so they are not a closed set: before C++17 the underlying storage is unspecified and even after it can hold any bit pattern that fits, so casting ints can produce enumerator-less values and MSVC is correct to demand exhaustiveness. The talk demonstrates surprising concrete examples (casting 3 into a 0..2 enum, using int storage, MSVC warnings) and suggests using libraries like battery num or wise enum (noting wise enum had MSVC issues).
AI-written summary · about
chapters (11)
- 0:00Intro
- 0:26Enums
- 0:41Booleans
- 0:54Swift
- 1:06Noms
- 1:20Switch Cases
- 1:38Use a Library
- 1:58Weird Error
- 2:35Enum Storage
- 3:28Visual Studio
- 4:22Enums are not closed values
related talks
19mLightning Talk: Your Favorite Undefined Behavior in C++
04mEnums four ways
54mTypical C++, But Why?
04mLightning Talk: A Journey Back In Time - C++ Evolution
01h 36mBuilding C++ Interfaces That Are Hard to Use Incorrectly
51mTypical C++, but Why?
05mThe dangers of C-style casts
05mEasing into Modern C++
