64 bit enum in C++?

后端 未结 10 1798
陌清茗
陌清茗 2020-12-09 16:35

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 ca

10条回答
  •  情书的邮戳
    2020-12-09 17:18

    Enum type is normally determined by the data type of the first enum initializer. If the value should exceed the range for that integral datatype then c++ compiler will make sure it fits in by using a larger integral data type.If compiler finds that it does not belong to any of the integral data type then compiler will throw error. Ref: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf
    Edit: However this is purely depended on machine architecture

提交回复
热议问题