-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Given the following enum definition:
#define BSDL_METADATA_DATA_RESULT_VALUES \
BSDL_METADATA_DATA_FAILURE, \
BSDL_METADATA_DATA_INVALID, \
BSDL_METADATA_DATA_OK \
MU_DEFINE_ENUM(BSDL_METADATA_DATA_RESULT, BSDL_METADATA_DATA_RESULT_VALUES)One would reasonably write:
int n=MU_ENUM_VALUE_COUNT(BSDL_METADATA_DATA_RESULT);However, "n" will not have the expected value (something out of range of the enum values), instead will get the value BSDL_METADATA_DATA_INVALID, which is well within the range of the enum values.
I suspect this could be fixed in several ways:
- document the intended usage of
MU_ENUM_VALUE_COUNT. - "magically" make the construct fail at compile time
Best Regards,
Andrei Porumb
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels