I respect Remy wishes to avoid the switch compilation, there are typically 2 outputs from the compiler, depending on the code and optimization settings:
If else as mentioned, this is typically used when there are few options in the switch statement or there is a large Delta between the switch enumerals.
Jump table if there are a large number of cases and they are mostly sequential the assembler can be a jump table where you have a start and the enumeral is an offset, this is more performance efficient, but not always space efficient and this is where your optimization settings come in.
There are edge cases which result in some quirky behaviour, but these are typically compiler specific
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I respect Remy wishes to avoid the switch compilation, there are typically 2 outputs from the compiler, depending on the code and optimization settings:
If else as mentioned, this is typically used when there are few options in the switch statement or there is a large Delta between the switch enumerals.
Jump table if there are a large number of cases and they are mostly sequential the assembler can be a jump table where you have a start and the enumeral is an offset, this is more performance efficient, but not always space efficient and this is where your optimization settings come in.
There are edge cases which result in some quirky behaviour, but these are typically compiler specific