Hacker News new | ask | show | jobs
by munchenphile 1467 days ago
goto makes sense in C for cleanup of local resources. Passing a bunch of pointers to pointers to another function for cleanup makes code far less readable (jumping around in a source file instead of just reading code linearly and freeing local resources in the scope in which they were allocated). Basically, forcing structured programming over using goto is the anti-lambda — requiring a lot of jumping around in the SOURCE file (not necessarily the binary) instead of linearly scanning through the code.

Dijkstra was wrong with his “goto” paper. It’s fine to admit that. He was right about most other things.

1 comments

Sure, there are uses. But they are not in this article. The article argues that without goto, an if statement can only conditionally execute one statement.

> The paper doesn't explain to us what would be the use of the "if" statement without a "goto" to redirect the flow of execution: Should all our postconditions consist of a single statement[…]?

Yes, the article is a joke.