by goto11 · 8y ago · 0 comments
The code in question should of course be written with an if. A goto would not really be an improvement, both goto and break are really weird way to express something which seems to be simple conditional.
I agree goto's a fine if they are the simplest and most readable solution. But this does not seem to be such a case.
- Introduce scopes and program structure instead of explicit labels (instruction addresses) and using control flow operators which rely on this structure
- Procedures and procedure calls
- Overriding and virtual functions where the system knows how to find the next instruction to jump to
- Concurrency and multi-threading where resume operation means essentially jumping to some (dynamic, not static) instruction address.
- Asynchronous and even-driven programming
Gotos are not unavoidable in high level languages.
Is there any non-syntactic difference between these two lines?
JMP Ox1234
GOTO label_1234
I think they are identical and the question is only where target labels can reside, how they are represented, and when the jumps are triggered (operation).