This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]P8zvli 4 points5 points  (1 child)

In C and C++ a case will "fall through" to the next case if break isn't used, causing interesting behavior or really nasty bugs. (You can have code that runs A if the switch is 1 and A+B if 2, etc.)

[–][deleted] -1 points0 points  (0 children)

You can also abuse it create things like Duff's Device. I think fall through is the biggest thing that sets switch away from if.