kaetzacoatl
kaetzacoatl

Reputation: 1469

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.

Upvotes: 5

Views: 3781

Answers (1)

Scotty Bauer
Scotty Bauer

Reputation: 1277

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.

Upvotes: 12

Related Questions