Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
14.3 and enum constants in macro expansion
#1
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.

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?


Messages In This Thread
14.3 and enum constants in macro expansion - by Timofei - 19-10-2023, 07:30 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)