19-10-2023, 07:30 AM
Hi,
We have a configuration macro with a value being an enum constant. We use that macro in an if-statement, and it violates the rule 14.3.
Note that in the case of enum constants we cannot convert the if-statement to a preprocessor #if-statement since the values of enum constants are not known at the preprocessing step. How can we solve this issue?
We have a configuration macro with a value being an enum constant. We use that macro in an if-statement, and it violates the rule 14.3.
Code:
enum my_enum {
MY_ENUM
};
#define CONF_MACRO MY_ENUM
if (CONF_MACRO == MY_ENUM) {...}
Note that in the case of enum constants we cannot convert the if-statement to a preprocessor #if-statement since the values of enum constants are not known at the preprocessing step. How can we solve this issue?