Day 23 of Advent of Compiler Optimisations!

Switch statements compile to jump tables, right? Well... sometimes. But what happens when your five-case switch becomes pure arithmetic? Or when checking for whitespace turns into a single mysterious constant and some bit manipulation? Turns out compilers have a whole bag of tricks beyond the textbook answer.

Read more: xania.org/202512/23-switching-
Watch: youtu.be/aSljdPafBAw

0

If you have a fediverse account, you can quote this note from your own instance. Search https://hachyderm.io/users/mattgodbolt/statuses/115768906477147196 on your instance and quote it. (Note that quoting is not supported in Mastodon.)