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

Christoph Bartoschek bartoschek@gmx.de
Thu Jan 29 22:34:00 GMT 2009


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



More information about the Gcc-help mailing list