I\'ve seen answers here for specific languages, about switches with more than 5 cases being optimized with jump tables to guarantee constant access time for any case.
Is
c (and by extension c++) only switches on integer types, so hashing is not necessary. The compiler will typically use an idiom appropriate to the architecture you're compiling for. This could be indexed addressing (if a small range is used), jump tables, or something entirely different.