104
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 19 May 2024
104 points (97.3% liked)
Programming
17314 readers
8 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 1 year ago
MODERATORS
switch statements are three gotos in a trenchcoat.
Anything is a goto in disguise when you think about it
In most CPU instruction sets, the only conditional instruction is branch (aka goto).
And after each instruction, the CPU go to the next instruction
Duff's device takes this to a whole new level.
This is very nice and clean
Egads! My eyes.
I'd rather it was just written in assembly. It's the
do {
opening a block under thecase 0
, but then proceeding to have furthercase
statements inside that block. You now have case statements in two different scopes that are part of the same switch.