4 ms·
See also GOTO which is a wart 99.9% of the time but really useful for writing e.g. parsers.
by phpnode 9y ago
See also GOTO which is a wart 99.9% of the time but really useful for writing e.g. parsers.
- dom0 9y agoError handling.
- johannes1234321 9y agoIn most languages there are better way to do this than goto. Among them - extracting code into smaller functions (yes, state has to passed around) - exceptions (yeah yeah, hate them or love them, but if used in your environment it makes sense not to avoid them) - RAII pattern or handling cleanup, which allows simple return and "automatic" resource handling - etc. True, in a language like C these don't apply necessarily and goto still has some use -
- vortico 9y agoParsers (or more generally state machines) and error handling are the two places I've seen that are acceptable. We've managed to complete the list. :)