Having this code:
// Called when x is "a"
#define do(x) doA()
// Called when x is "b"
#define do(x) doB()
Is it possible to make the preprocessor interpret do("a")
as doA()
and do("b")
as doB()
and maybe some other doUndefined()
if unknown x
provided? To clarify: I want to map x
parameter to arbitrary code or function call, not just call do{uppercase_x}()
. It must be done at compile time. And the x
parameter must be a string.
Thanks!