I would like to define a list of parameters, and then pass them to a macro.
However, the compiler (gcc) only sees one parameter, rather than expanding
the definition.
Could anyone suggest a way of making this work (using the preprocessor)?
#define MyList 1,2,3,4
#define Sum(a,b,c,d) a+b+c+d
x = Sum(MyList);
(n.b. i can pass 'MyList' to a function, but i'd rather pass it to a macro).
However, the compiler (gcc) only sees one parameter, rather than expanding
the definition.
Could anyone suggest a way of making this work (using the preprocessor)?
#define MyList 1,2,3,4
#define Sum(a,b,c,d) a+b+c+d
x = Sum(MyList);
(n.b. i can pass 'MyList' to a function, but i'd rather pass it to a macro).
Comment