c++ - Is enum members type still implementation-dependent? -
i've read articles c++11 none of them mentioned whether implementation-dependent size of members of enum keeps unchanged.
- is still case?
- if yes, pratice use
enum class token : int { ... };
explictly force compile make them of int type?
as per §7.2/5 of standard:
each enumeration has underlying type. underlying type can explicitly specified using enum-base; if not explicitly specified, underlying type of scoped enumeration type
int
.
(emphasis mine).
on matter (underlying type), standard not make difference whatsoever between enum
, enum class
/enum struct
.
Comments
Post a Comment