W
Walter Roberson
If you know the exact range of possible inputs and they are dense, then
use an array of function pointers.
If you do not know them, or they are sparse, then use a hash table to
locate your function pointer.
As the case labels are known ahead of time, a "perfect hash" could
be used, which in linear time would allow you to calculate an array
offset of the function pointer (or, of a structure that contains
the information needed to construct the function call.).