I'm trying to do something like the following:
//Bad; can't redefine macros; uses later definition.
#define foo )
#define foo(arg) ,arg)
That is, I want foo
(note: not a macro function) to map to one thing, and I want the macro function foo(arg)
to map to something else. So foo
needs to be some #define
constant (catching both cases) that maps onto . . . something.
I haven't been able to figure out a way, (and since this is a macro and a constant, the many previous questions do not apply). How can I do this?
Evil compiler-/platform-specific options are great too. Tagging this c for C-macros, although I'm using C++14.
Sidenote (by request): this could be used for e.g. making your own debug overloads for new
that would work with placement new as well:
#define new new(__FILE__,__LINE__ foo
//...
void const* p1 = new int();
void const* p2 = new (ptr) int();