c++ - 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
Aug 23 2012
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
Aug 23 2012








Nick Sabalausky <SeeWebsiteToContactMe semitwist.com>