64 bit enum in C++?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is there a way to have a 64 bit enum in C++? Whilst refactoring some code I came across bunch of #defines which would be better as an enum, but being greater than 32 bit causes the compiler to error. For some reason I thought the following might work: enum MY_ENUM : unsigned __int64 { LARGE_VALUE = 0x1000000000000000, }; 回答1: I don't think that's possible with C++98. The underlying representation of enums is up to the compiler. In that case, you are better off using: const __int64 LARGE_VALUE = 0x1000000000000000L; As of C++11, it is