This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: using same macro arg as both: var and "var"?


Am Donnerstag 29 Januar 2009 schrieb fkater@googlemail.com:
> #define macro1(a) void func##a(){ printf(a); }
>
> Either way, of course, I get an error:
>
> macro1(x);ÂÂÂÂÂÂ Â/* error: 'x' in printf not quoted */
> macro1("x")ÂÂÂÂÂ Â/* error: func"x" not a func name */


#define macro1(a) void func##a(){ printf(#a); }

and use it:

macro1(x)


Christoph


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]