this post was submitted on 07 Oct 2025
79 points (98.8% liked)

Programmer Humor

27193 readers
996 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

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] stormeuh@lemmy.world 4 points 3 weeks ago

Seems like it's mostly error handling, which makes total sense to me. In a function with a lot of error conditions, where it also takes more than return <nonzero value> to report that error, the code would get very cluttered if you handle the errors inline. Using goto in that case makes the normal case shorter and more readable, and if proper labels are used, it also becomes clear what happens in each error case.

Sure, you can do that with functions too, but it's much nicer staying in the same scope where the error occurred when reporting on it. Putting things in a function means thinking about what to pass, and presents extra resistance when you want to report extra info, because you have to change the function signature, etc.