Re:Linux Coding Style Guide: GOTOs not always considered har...
by nitrogen on Tuesday August 23, 2011 @06:44PM
(#2918674)
In this case it might be clearer to just run the switch again after ALPHA and BETA with GAMMA as the machineState, and if necessary, have logic in GAMMA for switching machineState back to ALPHA or BETA.
It also might be clearer to move GAMMA outside the switch block entirely:
int shouldGamma = 0;
switch ( machineState ) {
case ALPHA:
... alpha prep ...
shouldGamma = 1;
break;
case BETA:
... beta prep ...
shouldGamma = 1;
break;
case GAMMA:
shouldGamma = 1;
break;
}
if(shouldGamma) {
// GAMMA stuff here
}
The shouldGamma flag would be unnecessary if all possible values for machineState should still run the code in GAMMA.
It also might be clearer to move GAMMA outside the switch block entirely:
The shouldGamma flag would be unnecessary if all possible values for machineState should still run the code in GAMMA.