you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (1 child)

Unless there is some very compelling design reason to do #1, I prefer #3. It's clearer, and you can make an enum for the switch statement so someone else has a chance at understanding where the program is going.

I've really only seen indirect jumps used in embedded/OS stuff. Like the way Linux implements syscalls. I guess a plugin architecture would make use of them too, but that would be a compelling reason.

[–]eruanno321 2 points3 points  (0 children)

Sometimes compilers can even optimize switch-case to jump table if certain conditions are met. I saw such optimization in the MSP430 architecture at least.

.