Solutions
- Replace GOTO with structured code
- Use exceptions
Imho exceptions aren't much better. They are essentially a goto where
- you don't know where you're going,
- you can send data with it (including context) and
- you can guarantee execution of code if needed (I've never really worked with
gotos but I assume there is no equivalent to finally).
2 & 3 are nice and probably the reason why they are still used today, but 1 is terrible for understanding bigger systems.
Imho exceptions aren't much better. They are essentially a
gotowheregotos but I assume there is no equivalent tofinally).2 & 3 are nice and probably the reason why they are still used today, but 1 is terrible for understanding bigger systems.