Timeline for Why are cases in a switch statement not isolated?
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 11, 2015 at 0:22 | comment | added | Jules | @Mephy Duff's device should never be used in real code; the compiler is generally better at making such optimizations than the programmer. On the other hand, it did inspire Simon Tatham's implementation of coroutines in C, which is IMHO the best use of this facility I've ever seen... | |
| Feb 17, 2015 at 18:43 | comment | added | 3Doubloons | @Bartvbl: I wrote a switch statement a few years ago to interpret html colour values, notably the #rgb and #rrggbb syntaxes. To avoid repeating code, I had the #rgb case convert the value to #rrggbb format, then falling through to that case | |
| Feb 17, 2015 at 18:06 | comment | added | Mephy | @Bartvbl en.wikipedia.org/wiki/Duff%27s_device | |
| Feb 17, 2015 at 17:46 | history | edited | Thomas Stringer | CC BY-SA 3.0 | added 188 characters in body |
| Feb 17, 2015 at 17:43 | comment | added | Robert Harvey | @Bartvbl: A multiple-match conditional test is a case where more than one value can satisfy the switch condition. It is the only exception that the C# language makes for fall-through behavior. | |
| Feb 17, 2015 at 17:41 | comment | added | Bartvbl | Can you give an example of where this would be useful? | |
| Feb 17, 2015 at 17:40 | history | answered | Thomas Stringer | CC BY-SA 3.0 |