I have a general macro:
#define mSwitch( Root, Case ) Root##_Case_##Case
#define mSpecialDisplay( what, Val ) mSwitch(mSpecialDisplay,what)(Val)
#define m
This is the usual idiom for this:
#define mSwitch(Root, Case) mSwitch_(Root, Case)
#define mSwitch_(Root, Case) Root##_Case_##Case
All of the arguments to a C preprocessor macro are fully expanded before the macro itself is expanded, unless the #
or ##
operator is applied to them; then they're not expanded. So to get full expansion before ##
, you pass the arguments through a wrapper macro that doesn't use ##
.