c - Weird #define declaration, can't understand to what it expands -
i have #define
statement in legacy code i'm inspecting in c.
#define step(x) case x: step ## x : wpan_startup_step = x;
this macro replace cases in big switch state machine. can't understand what's going on in macro. expand ?
##
concatenation, means result this:
step(1) case 1: step1: wpan_startup_step = 1;
or example:
step(v) case v: stepv: wpan_startup_step = v;
this macro not make sense me, since generates x: stepx:
maybe usage example clarify this.
if want see expansion of macro use: gcc -e program.c
also place learn macros: http://gcc.gnu.org/onlinedocs/cpp/macros.html
Comments
Post a Comment