Re: How to accumulate tokens in #define'd ident ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27 May 2014 06:11, phi gcc wrote:
> Hi All,
>
> I have a beginner question.
> I have an ident that I #define this is a comma separated list of other
> ident, and I'd like to augment this list, i.e basically something like
>
> #define L a
> #define T L
> #undef L
> #define L T,b
>
> I have a growing list of ident (here a,b) I'd like to grow this as
> include files to end up with a,b,c,d at some point this is given to a
> va_args function like f(L)
>
> Indeed I know that the above #define/#undef will not make it, yet I
> tried a lot of combo with ## in macro like
>
> #define A(l,x) l##,##x
> #define l a
> #define t A(l,b)
> #undef l
> #define l t
>
> But nothing works.

You could have a look at how Boost.Preprocessor does this kind of
thing, but using the preprocessor like this leads to madness.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux