News for hackers. Stuff that matters.
Re:‘Abusing’ the C switch statement – beauty is in the eye o... by geofft on Thursday February 02, 2017 @12:40PM (#13552528)
A switch statement is just a bunch of gotos who have hurriedly put on an ill-fitting suit and tie to look respectable.

Any context where you would want "if x == this, goto here; if x == that, goto there" is a potential place to use the switch statement. Duff's device is a good example, but there are many things that can be built this way.

Re:‘Abusing’ the C switch statement – beauty is in the eye o... by dllthomas on Thursday February 02, 2017 @11:06PM (#13557588)
> Any context where you would want "if x == this, goto here; if x == that, goto there" is a potential place to use the switch statement.

Only if "here" and "there" are later on in the same block.