3 ms·
Enums can end up with hundreds of values, and no one wants to do all the tedious code reviews to make sure 'case LONG_VARIABLE_ABRV: return "LONG_VARAIBLE_ABRV"
by benlivengood 3y ago
Enums can end up with hundreds of values, and no one wants to do all the tedious code reviews to make sure 'case LONG_VARIABLE_ABRV: return "LONG_VARAIBLE_ABRV"' doesn't have errors in it for every single one.
This is even more important if the enums drive a serializer/deserializer and the hand-coded std::map<string,int> doesn't match the hand coded std::map<int,string> or if either doesn't match the actual enum. Or if you set an alert on the wrong error message because it's spelled differently in the code and in the time-series database.
Source: have replaced production C++ enums and arrays/string-maps with macros after the originals got out of sync after a few years.