Talk:Goto/Archive 1

Restored Pascal as language with goto. See (1981) and ISO7185, section 6.8.2.4(PDF)(1990) JamesDay 14:26, 25 Oct 2003 (UTC)

The page claimed that Dijkstra's argument in Considered Harmful was narrowly about "autoindexed variables." After reviewing the article, I disagree with both the description of the argument and the limitation. Dijkstra was unequivocal that unrestricted GOTO should be abolished generally. In support of this general claim, he cited the difficulty of summarizing a program's progress toward its result (in order to analyze the program) when it progresses arbitrarily. There is no mention in the letter of auto-anything. -- MW

Semi-random personal note: the first program I ever wrote was the 'infinite loop' example given in the article almost verbatim. In fact the only difference was that the text to be printed was different, and much longer(though I forget what it was, exactly). I did it in the sixth grade, with not so much as basic introduction to programming, on an Apple IIe with no disk in it. I had surmised based on it's behavior with no disc in it that it was waiting for something to execute, and cobbled that together based on fragments of BASIC I'd seen in my math textbooks. I deliberately infinite looped it 'cause it seemed funny at the time. Lucky me, it executed flawlessly, throwing up massive amounts of text...but only for a few seconds, as it crashed out with some sort of error. I think it ran out of memory(been so long the details are hard to remember). So yeah, they ain't kidding about the infinite loops. -Graptor

Does GOTO really lead to inadvertent infinite loops?
The article claims that GOTO leads to infinite loops, illustrating this with a BASIC code fragment:

10 PRINT "Hello, world!" 20 GOTO 10

But in BASIC dialects that implement structured programming, it's possible to write an equivalent infinite loop without a single GOTO:

DO  PRINT "Hello, world!" LOOP WHILE 0 = 0

Or equivalently in C:

do { puts("Hello, world!"); } while(0 == 0);

So is this a bad example? Is there a short way to express how use of GOTO leads to inadvertent infinite loops? --Damian Yerrick 03:40, 30 December 2005 (UTC)


 * Bugs come from failing to be thorough, not from any particular keyword (or language). GOTO is unconditional, unlike your two WHILE examples. That's probably the original point of the "infinite loops" assertion, and the article should be fixed to make that clear. -- Mikeblas 22:59, 9 January 2006 (UTC)

Nonlocal goto merge
I'd like to cast a vote in agreement with whomever suggested that Nonlocal_goto_(computer_science) should be merged into this document. Rainwarrior 17:08, 7 February 2006 (UTC)

Nonlocal gotos are formally called continuations, and I have merged accordingly. Gazpacho 00:20, 4 March 2006 (UTC)

Missing Knuth doc
The link to Knuth's Structured Programming with Goto Statements is 404'd. The only other source I could find is the ACM portal, which requires registration. -- 03 May 2006