How to use # inside a macro definition
Eljay Love-Jensen
eljay@adobe.com
Mon Nov 10 12:37:00 GMT 2003
Hi Kapil,
You cannot embed preprocessor directives in a macro expansion. They neither get evaluated at the time of macro definition, nor at the time of instantiation.
Perhaps that's unfortunate. But that's the way it is.
You'll have to figure out an alternative implementation, such as the one from gertom.
Or you could write your own pre-preprocessor. If you do opt for this solution, I recommend using Perl as the engine or use lex (i.e., GNU flex). Instead of writing a parser from scratch -- unless your in it for the sheer fun of tokenizing C/C++. :-)
HTH,
--Eljay
More information about the Gcc-help
mailing list