Question

Is there any way to generate as a preprocessor macro and the use of the concatenate directive the cases for a switch-case statement. Im using C and I would like to create several cases for a switch.case statement as.

#define select_case(value) \
switch (values) \ Assume an enum with the values
case prefix_##value: \
break;\
default:\
break;\

That is a general idea. did you get me? Is it possible?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top