API design note: Beware of adding an “Other” enum value
https://devblogs.microsoft.com/oldnewthing/20250217-00/?p=110873 [devblogs.microsoft.com]
2025-03-17 22:11
If you return WidgetFlavor::Mint, then this will confuse code written with the Version 1 API, because they expected to get Other for anything that isn’t vanilla, chocolate, or strawberry. The word “other” means “not mentioned elsewhere”, so the presence of an Other logically implies that the enumeration is exhaustive. On the other hand, you obviously should return WidgetFlavor::Mint because that’s why you added the value to the enum in the first place!