Given:
#define f(x, y) (x+y)
#define g(x, y) (x*y)
#define A 1, 2
#define B 2, 3
int main() {
int a = f(A);
int b = g(A);
int c = f(B);
int d = g(B);
}
which doesn't work
how can i make it work? The main idea is that I have one list of arguments that I want to pass to two different macros, without repeating each time the list of long arguments.
Is there any way to do this? [You can change f and g; you can even change A and the way I call macros. The only requirements are: 1) the argument list can appear only once 2) it cannot be hardcoded ... so that I can call macros with different arguments
If you solution doesn’t quite work, but “almost works” (almost such a definition for you), I would also like to hear it, maybe I can fake it for work.
Thank!
: f g . .