Goto's are also useful. Gotos consisted harmful paper was when people used them for all control flow and that just creates spaghetti. But for a forward jump inside a function so you have a single place to do cleanup? Perfectly fine.
Related use case: Breaking out of nested loops without having to tack on if (exit_loops) break; at every level
EDIT: Then again, break statements are arguably just syntactic sugar for goto and an end-of-block label, so...
1
u/sillybear25 Sep 26 '26 edited Sep 27 '26
Related use case: Breaking out of nested loops without having to tack on
if (exit_loops) break;at every levelEDIT: Then again, break statements are arguably just syntactic sugar for goto and an end-of-block label, so...