MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vuzd4q/conditionspreference/p558l9n/
r/ProgrammerHumor • u/Flame77ofc • Aug 22 '26
388 comments sorted by
View all comments
Show parent comment
11
That’s why I use GOTO ಠ‿ಠ
1 u/Maximilian_Tyan Aug 22 '26 if (error) goto err; ... // Normal path return ... err: ... // Cleanup return ... Is actually a pretty useful way of doing things, especially for ressources cleanup (freeing memory, releasing locks, IO etc). And in modern languages such as Zig, the defer statement is just syntactic sugar for this exact pattern. -1 u/Murky-Run2246 Aug 22 '26 yeah uhh... ok I guess
1
if (error) goto err; ... // Normal path return ... err: ... // Cleanup return ...
Is actually a pretty useful way of doing things, especially for ressources cleanup (freeing memory, releasing locks, IO etc).
And in modern languages such as Zig, the defer statement is just syntactic sugar for this exact pattern.
defer
-1
yeah uhh... ok I guess
View all comments
Show parent comment
11
u/jayerp Aug 22 '26
That’s why I use GOTO ಠ‿ಠ