If enum always int , then the following would be unsafe:
enum oops { foo = 32767, bar, };
This is because int can be like 16 bits (and this is still surprisingly common). On a system with a 32-bit int you can set foo = 2147483647 , and your compiler will certainly not choose int as the base type.
Thus, smart C ++ bots indicate that the base type enum should be able to display the given values, and the compiler can choose the appropriate one. Given that int often regarded as a native type of machine, it is often a smart choice.
If you want to know the base type of enum , then std :: basic_type provides this.
source share