this post was submitted on 07 Oct 2025
1 points (100.0% liked)

Programmer Humor

27412 readers
2087 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
top 5 comments
sorted by: hot top controversial new old
[–] Gladaed@feddit.org 2 points 1 month ago (1 children)

Error handling and multi loop exiting are permitted use cases of go-to.

[–] ZILtoid1991@lemmy.world 0 points 1 month ago (1 children)

I also use it for avoiding recursive function calls. In theory, this will tell the compiler to just ditch the current stack and go back to the beginning of the function.

[–] bitcrafter@programming.dev 1 points 1 month ago

In civilized languages tail recursion takes care of this for you. 😁

[–] frezik@lemmy.blahaj.zone 1 points 1 month 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.

[–] hades@programming.dev 1 points 1 month ago

but how many COMEFROMs are there