3 ms·
Edit: d'oh - I misread, the addendum is doing exactly this... I don't understand the need for the macro-fu to generate the case values. The use of switch_step
by bacon_waffle 8y ago
Edit: d'oh - I misread, the addendum is doing exactly this...
I don't understand the need for the macro-fu to generate the case values. The use of switch_step++ in each previous case seems to drive that, but couldn't the same be accomplished by setting switch_step to a constant?
static int switch_step = 0;
switch(switch_step) { // Falls through between cases
default:
#if METHOD_0_AVAILABLE
switch_step = 0;
case 0:
if (method_0_works(...))
break;
#endif METHOD_0_AVAILABLE
#if METHOD_1_AVAILABLE
switch_step = 1;
case 1:
...
}