Nested macro iteration with C preprocessor
问题 With the C preprocessor you can have some kind of high-order macros. Something like this: #define ABC(f) f(a) f(b) f(c) #define XY(f) f(x) f(y) #define CODE(x) foo_ ## x ABC(CODE) #undef CODE #define CODE(x) bar_ ## x XY(CODE) #undef CODE The output is: foo_a foo_b foo_c bar_x bar_y Is there some trick to nest such iterations, to do something like this? #define CODE(x) foo_ ## x NEST(ABC, XY, CODE) #undef CODE So the output would be: foo_ax foo_ay foo_bx foo_by foo_cx foo_cy In particular, I