C++ How to get sizeof(enum) == sizeof(char)? -


i know how.

i have looked @ this topic, , understand "the choice of type implementation-defined.", curious know how 1 instead of 4.

c++11 introduced way change underlying type of enum.

enum foo : char { ... }; enum class foo : char { ... }; 

still, you're better off using default int in cases.


Comments