Note to OP: investigate your compiler's assembly output of a switch statement with and without "holes" for cases; let us know if it effectively creates an if-else tree. This will help find a solution if we know more of the limitations.
Note to OP: investigate your compiler's assembly output of a switch statement with and without "holes" for cases; let us know if it effectively creates an if-else tree. This will help find a solution if we know more of the limitations.
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
The switch statement does a compare and branch to each Case defined. It ignores holes and only generates branches to valid Cases.
It's a Jump Table not an If..else. It executes much faster than an if..else.