i have function in program takes 3 arguments. times in code there macro defining 2 of these parameters.
so this:
void func(int x, int y, int z){...}
can invoked this:
#define par 10,20 int z = 3; func(par, z);
now, need change code function called macro function.
#define func(x,y,z) func2(x,y,z,#z)
this works fine if x , y passed variables. there way make work macro par?
i'm using gcc 4.6
you can level of indirection, (ab)using variadic macros:
#include <stdio.h> #define par 2,3 #define f(...) g(__va_args__) #define g(a,b,c) h(a,b,c) void h(int a, int b, int c) { printf("%d %d %d\n", , b, c); } int main() { f(par, 42); return 0; }
there better solution underlying problem.