Concatenate using ## directive (switch cases)
-
18-10-2022 - |
سؤال
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?
لا يوجد حل صحيح
لا تنتمي إلى StackOverflow