3 ms·
This is my one of my favourite patterns with nested functions - clean code, and avoid a ratsnest of 70s basic style GOTO. It starts with one goto, then one mor
by mhh__ 4y ago
This is my one of my favourite patterns with nested functions - clean code, and avoid a ratsnest of 70s basic style GOTO.
It starts with one goto, then one more, then another.
The first goto is usually clever but then someone else arrives and hacks another one because they don't want to change the code too much.
- int_19h 4y agoCleanup goto-style is hard to describe as a "rat's nest", since all the gotos in the same function go to the same label at the end that just does all the cleanup before returning. There's nothing clever about it, and many codebases wrap it into macros and such to make the syntax more concise and the intent explicit.
- mhh__ 4y agoCleanup is mostly fine but people see the goto fail then start using them for other things because there's already a goto there and thus congruent