3 ms·
It is possible to reason about the effects of a goto into the middle of a for loop (or switch case), of course, but doing so is likely to make you angry. :) I
by unwind 14y ago
It is possible to reason about the effects of a goto into the middle of a for loop (or switch case), of course, but doing so is likely to make you angry. :)
I believe those are reason enough to avoid doing those particular things, even if the global jumping of assembly of course is even worse.
- nitrogen 14y agoOf course, this is the part where someone mentions Duff's Device, which uses a do..while spanning multiple switch labels. This is possible because switch works a lot like goto. http://en.wikipedia.org/wiki/Duffs_device http://en.wikipedia.org/wiki/Duffs_device
- pi18n 14y agoI agree in the general case but there are many cases where a goto statement is actually more readable than the alternatives in C. Especially if you choose descriptive labels.