292: goto

explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search
goto
Neal Stephenson thinks it's cute to name his labels 'dengo'
Title text: Neal Stephenson thinks it's cute to name his labels 'dengo'

[edit] Explanation

goto is a construct found in many computer languages that causes control flow to go from one place in program to another, without returning. Once common in computer programming, its popularity diminished in the 60's and 70's as focus on structured programming became the norm. Edsger Dijkstra's article Go To Statement Considered Harmful in particular contributed to the decline of goto.

Often people learning programming are told goto is bad and should be avoided, but frequently are not given a reason. In this case, Cueball can see no harm in using goto to avoid rewriting much of his program. As a result, he is attacked by a velociraptor. Velociraptor attacks are a running joke (and fear) often expressed in xkcd. The humor derives from the fact that a velociraptor attack is an unlikely thing to happen after using a goto statement.

The title text refers to Neal Stephenson, an author of cyberpunk novels. A label is used in many programming languages to refer to a point in a program that a goto instruction can jump to. The joke is that one of Stephenson's characters in Cryptonomicon is named 'Goto Dengo'.

[edit] Transcript

[Man sits at computer, thinking]

Man: I could restructure the program's flow - or use one little 'GOTO' instead.

Man: Eh, screw good practice. How bad can it be?

Text on computer: goto main_sub3;

*Compile*

[Panel passes in which man simply looks at the computer]

[A raptor jumps into the panel and attacks the man at the computer]

Comment.png add a comment!

Discussion

Note that the concept of goto being harmful fortunately is weaning a little.

Jumping forwards in code to the end where error handling is implemented is actually in wider use now; including many locations in the Linux kernel. Kaa-ching (talk) 09:53, 9 September 2012 (UTC)

Actually, goto has been used quite with some frequency in low-level code in C programming over the years, so it's not altogether surprising that it is used in the Linux kernel, or any other tight bit of code. Given the "advance" of programming languages, I wouldn't say that there's been any weaning, except off of the concept of an unstructured goto in more recent languages. Admittedly, there's a schism between the low-level (that is, near-to-assembly) coders who more readily use goto because in the end, that's what the compiler reduces code branching down to, and developers using higher-level languages (that is, more highly abstracted, more removed from 1 statement ~ 1 machine instruction languages) avoiding such because alternative structures abound, making goto somewhat unnecessary. There has been a bit of a dogmatic approach to teaching various languages, as in "thou shalt not use goto lest thou produce monsterous, unmaintainable code!" applied that many if not most developers observe; the humor in the panel is that this dogma is manifested in the appearance of a literal monster (a velociraptor, no less...) -- IronyChef (talk) 05:08, 11 September 2012 (UTC)
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox
New Server Fund