List:MySQL++« Previous MessageNext Message »
From:Jonathan Wakely Date:December 8 2008 9:44pm
Subject:Re: Using macros to compose SSQLS structures.
View as plain text  
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
> example:
>
> #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.

Jonathan
Thread
Using macros to compose SSQLS structures.Ryan W. Frenz3 Dec
  • Re: Using macros to compose SSQLS structures.Warren Young3 Dec
    • Re: Using macros to compose SSQLS structures.Ryan W. Frenz3 Dec
      • Re: Using macros to compose SSQLS structures.Warren Young3 Dec
        • Re: Using macros to compose SSQLS structures.Ryan W. Frenz3 Dec
          • Re: Using macros to compose SSQLS structures.Warren Young4 Dec
      • Re: Using macros to compose SSQLS structures.Rick Gutleber4 Dec
      • Re: Using macros to compose SSQLS structures.Jonathan Wakely8 Dec