I have this #define statement in legacy code I’m inspecting in C.
#define STEP(x) case x: STEP ## x : WPAN_Startup_Step = x;
This is a macro to replace cases in a very big switch state machine.
I can’t understand what’s going on in this macro. What does it expand to ?
##does a concatenation, this means that the result will be something like this:or another example:
this macro does not make to much sense to me, since it generates
x: STEPx:maybe a usage example would clarify this.
if you want to see the expansion of a macro use:
gcc -E program.calso a good place to learn about macros: http://gcc.gnu.org/onlinedocs/cpp/Macros.html