How to accumulate tokens in #define'd ident ?

phi gcc phi.gcc@gmail.com
Tue May 27 05:12:00 GMT 2014


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.

Thanx for any helps
Cheers,
Phi



More information about the Gcc-help mailing list