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

Programmer Humor

26898 readers
753 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
[–] frezik@lemmy.blahaj.zone 10 points 1 week ago

IIRC, this is because gcc optimizes goto very well, or at least it did back in the day. It also is a genuinely workable solution for error handling in C.

Consider if you need to setup three things, do something with them, and then tear them down in reverse order. If there's an error on the second thing, you want to jump right to the part where you tear down the first thing. Using goto tends to make cleaner code for that in C compared to, say, nested conditionals.