|
|
|
|
|
by wahern
2077 days ago
|
|
It's also used to portably implement generators and coroutines. See https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html More generally, the semantics are useful for machine code generation and translation. Computed goto's are even more useful for the above, but they're an extension. I'd love to see computed goto's added to the C standard, but it's far too late to change the semantics of switch. Rather, just accept that their code flow semantics make them slightly more type safe syntactic sugar for goto--not just in how they're implemented, but in how they can be used. |
|