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 does not work,
how can I make it work? The basic idea is that I have one list of arguments that I want to pass to two different macros, without repeating the list of long arguments every time.
Is there a way to do this? [You're welcome to modify f & g; you're even welcome to modify A & the way I call the macros. The only requirements are: 1) the arguemnt list can only appear once 2) it can't be hard coded ... so that I can call the macros with different arguments
If you're solution doesn't quite work but 'almost works' (for you definition of almost), I'd like to hear it too, perhaps I can fudge it to work.
Thanks!
Edit: f & g must be macros. They capture the symbol names and manipulate them.