This is the mail archive of the gcc@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: [RFC] Parametrized macro names


On Wed, 5 Mar 2003, Fabio Alemagna wrote:
> I'm writing some code which would benefit greatly from the feature I'm
> going to describe, and I suspect this feature could come handy to many
> others as well, when playing with the preprocessor.
>
> Basically, what I'd like the preprocessor to do is to allow this kind of
> macro:
>
>     #define macro ## param1 ## param2 ## ... ## paramN macrobody

One more thing: for the above line to be really useful, it would be also
needed that the preprocessor handled the case in which '##', in a macro
body, is followed by a macro name, and not just by a parameter's name. I
don't think it would cause any problems.

Right now, this code doesn't work as one would expect:

    cpp << EOF
    #define macro1 foo
    #define macro2 baz ## macro1

    macro2
    EOF

produces

    bazmacro1

rather than

    bazfoo

as one might expect.

Regards,
Fabio Alemagna


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