I've been facing a problem with my enum
after getting past the 32nd flag:
enum ConditionType_t {
CONDITION_NONE = 0,
CONDITION_LIGHT = 1 << 0,
CONDITION_INFIGHT = 1 << 1,
CONDITION_MUTED = 1 << 2,
...
CONDITION_LUCKY = 1 << 32,
}
Knowing that enums
are basically 8bit
, CONDITION_LUCKY
will be equal to the CONDITION_NONE
. So I implemented C++11
's enum classes
:
enum class ConditionType_t : uint64_t {
CONDITION_NONE = 0,
CONDITION_LIGHT = 1 << 0,
CONDITION_INFIGHT = 1 << 1,
CONDITION_MUTED = 1 << 2,
...
CONDITION_LUCKY = 1 << 32,
}
Now I get millions of warnings like:
warning C4293: '<<' : shift count negative or too big, undefined behavior
And errors like:
error C2065: 'CONDITION_NONE' : undeclared identifier
Apparently, bit shifting doesn't get along with enum classes
.
Any thoughts?
Aucun commentaire:
Enregistrer un commentaire