Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switch statement without jump table

Is it possible to use a switch statement without a jump table? GCC creates stupid (and in my case unusable) jump tables which I want to avoid.

like image 955
kaetzacoatl Avatar asked Dec 19 '22 13:12

kaetzacoatl


1 Answers

https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html

-fno-jump-tables

Do not use jump tables for switch statements even where it would be more efficient than other code generation strategies. This option is of use in conjunction with -fpic or -fPIC for building code that forms part of a dynamic linker and cannot reference the address of a jump table. On some targets, jump tables do not require a GOT and this option is not needed.

like image 102
Scotty Bauer Avatar answered Jan 11 '23 13:01

Scotty Bauer