04/20 I'd like to have C/C++ macro which would replace any comma
seperated list of variables with an expression which uses those
variables. For example:
DO_SOMETHING(a,b,c,d) becomes=> expression a,b,c,d
DO_SOMETHING(a,b) becomes=> expression a,b
In other words, I don't know how many variables may be used ahead
of time. Any ideas?
\_ Just what we need, wannabe C programmers want to write stuff
the langauge doesn't support.
\_ Use Perl, you idiot.
\_ this problem is a trival one. just make your DO_SOMETHING
a function that takes varargs.
\_ Thought of that, but it needs to deal with declarations.
Also, I'd like to be able to expand MACRO(x,y,z) to be:
A::x = f();
A::y = f();
A::z = f();
Where x,y,z are static const members.
\_ What about instead of D(a,b,c,d),
#define DO_SOMETHING expression
Then you can just use: DO_SOMETHING a,b,c,d |