这是一个基本问题,我希望Google很容易找到答案,但没有找到答案。隐式转换为枚举
比方说,我有一个枚举:
enum abc { a, b, c };
支持哪些隐式转换?编译器之间是否有编译器扩展或不同的行为?
我问隐式转换到一个枚举:
enum abc test = (** which type can appear here? **);
除了隐式转换,从一个枚举:
(** which type can appear here? **) test2 = test;
我想知道同时适用于C的答案, C++。
你应该让你的问题更具体,这很有趣。但是你知道*哪种类型可以出现在这里?*是'int',对吗? –
@iharob总是这样吗? http://ideone.com/5WvR9K ...这就是为什么我要求 – Paul
@iharob不能在像'1e2'这样的范围内使用'short'或'signed char'或'_Bool'或'double'值? – chux