this post was submitted on 01 Sep 2025
462 points (98.9% liked)
Programmer Humor
26152 readers
1033 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I mean, in C too.
I used it when I wrote some throwaway C++ code working with SQLite. Since it had no RAII (and I had no intention of writing my own wrapper), I had to manually cleanup multiple resources somehow. If at least one resource failed to initialize, I had to deinitialize the ones that didn't fail. It was either
goto
or a bunch of flags to track what is initialized.goto
looked more elegant.I misremembered the whole thing. It was still related to cleaning up after a failure, but there was only one resource I had to deal with. That's how it looks like: