3 ms·
I do not believe the article is correct, then. Dijkstra's goto paper squarely applies to the C local goto. The subject of the paper is not specifically machine
by kazinator 3y ago
I do not believe the article is correct, then. Dijkstra's goto paper squarely applies to the C local goto. The subject of the paper is not specifically machine language branch instructions that can go anywhere, or something like the global goto in line numbered BASIC (a language he did revile, claiming that it damages the brain).
I'm looking at the paper again. It clearly states that goto should be abolished from higher level languages.
Note that Dijkstra also lumps the repetition statement (while B repeat A / repeat A until B) with goto, and then carefully argues why that is an acceptable use of goto, namely that it is susceptible to analysis by induction.
I can't see how I can reach a conclusion other than that,
yes, C has a goto of a type that Dijkstra considered harmful.
Some have argued that forward goto in C is easily analyzable, since it doesn't create loops. There are coding standards that permit forward goto, but not backward goto. What Dijkstra would have thought about the inclusion of a forward-restricted goto in a HLL is anyone's guess.
A C forward goto could jump from the middle of one loop into the middle of another one, though. Simply being forward isn't enough to ensure a certain property of the function's control flow graph. This is written about extensively in the Dragon Book.