August 24, 2012 This possible with C/C++ macros? | ||||
---|---|---|---|---|
| ||||
With the C/C++ preprocessor, is there a way to have a macro argument expand like this? (where '??????' is what I don't know what to write): // Just an illustrative example obviously pointless as-is: #define FACTORY_OF(a) ?????? FACTORY_OF(Bar).blah // Make that expand to: BarFactory.blah |
August 24, 2012 Re: This possible with C/C++ macros? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | On Thu, 23 Aug 2012 21:31:53 -0400 Nick Sabalausky <SeeWebsiteToContactMe@semitwist.com> wrote: > With the C/C++ preprocessor, is there a way to have a macro argument expand like this? (where '??????' is what I don't know what to write): > > // Just an illustrative example obviously pointless as-is: > > #define FACTORY_OF(a) ?????? > FACTORY_OF(Bar).blah > > // Make that expand to: > BarFactory.blah > Oops, found what I needed here: http://gcc.gnu.org/onlinedocs/cpp/Concatenation.html Solution: #define FACTORY_OF(a) a##Factory |
Copyright © 1999-2021 by the D Language Foundation