2008/12/3 Ryan W. Frenz:
> My problem is simply one of the macro-expansion I'm trying to do not
> working the way I expect. In a way more general, non mysql++ related
> #define FIRSTARGS a0, a1
> #define SECONDARGS a2, a3
> #define MACROREQUIRINGFOURARGS(a,b,c,d) ...
> MACROREQUIRINGFOURARGS(FIRSTARGS, SECONDARGS) // does not work
> The way I understand cpp's macro expansion, this should first expand to:
> MACROREQUIRINGFOURARGS(a0, a1, a2, a3)
> and as a result work fine. But I'm wrong.
Yep. What you need to do is create a new macro that takes two args:
#define MACROTAKINGTWOARGS(A, B) MACROREQUIRINGFOURARGS(A, B)
now you can use MACROREQUIRINGTWOARGS(FIRSTARG, SECONDARG)
and the expansion happens at the right time.