Editing 292: goto

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 10: Line 10:
 
''{{w|Goto}}'' is a construct found in many computer languages that causes control flow to go from one place in a program to another, without returning. Once common in computer programming, its popularity diminished in the 1960s and 1970s as focus on {{w|structured programming}} became the norm. {{w|Edsger W. Dijkstra}}'s article [https://dl.acm.org/doi/10.1145/362929.362947 "Go To Statement Considered Harmful"] in particular contributed to the decline of ''goto.''
 
''{{w|Goto}}'' is a construct found in many computer languages that causes control flow to go from one place in a program to another, without returning. Once common in computer programming, its popularity diminished in the 1960s and 1970s as focus on {{w|structured programming}} became the norm. {{w|Edsger W. Dijkstra}}'s article [https://dl.acm.org/doi/10.1145/362929.362947 "Go To Statement Considered Harmful"] in particular contributed to the decline of ''goto.''
  
βˆ’
Often, people learning programming are told that ''goto'' is bad and should be avoided, but frequently, they are not given a good reason. [[Cueball]], as one of these people, sees no harm in using ''goto'' to avoid rewriting much of his program, most likely written in the C programming language. As a result, he is attacked by a [[velociraptor]]. Velociraptor attacks are a running joke (and fear) often expressed in [[xkcd]].  
+
Often, people learning programming are told that ''goto'' is bad and should be avoided, but frequently, they are not given a good reason. [[Cueball]], as one of these people, sees no harm in using ''goto'' to avoid rewriting much of his program, most likely written in the C programming language. 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 a perfectly reasonable and valid consequence of invoking ''undefined behavior'' in C, but it is an {{tvtropes|WhatCouldPossiblyGoWrong|unexpected and severe consequence}} if the ''goto'' statement is used correctly, let alone that velociraptors have been extinct since the Cretaceous Period.{{Citation needed}} However, the C specification allows time travel in the face of undefined behavior, so a velociraptor attack ''now'' is valid under the spec if some unrelated undefined behavior occurs ''some time in the future''.<ref>"However, if any such execution contains an undefined operation, this International Standard places no requirement on the implementation executing that program with that input (not even with regard to operations preceding the first undefined operation)."</ref>
  
 
The name ''main_sub3'' of the ''goto'' destination also shows bad programming style: it is an unmeaningful name suggesting that at least two similarly unmeaningful names are used for other ''goto'' marks and it is contradictory in that a chunk of code can either belong to the main program or to a subroutine, but not both.
 
The name ''main_sub3'' of the ''goto'' destination also shows bad programming style: it is an unmeaningful name suggesting that at least two similarly unmeaningful names are used for other ''goto'' marks and it is contradictory in that a chunk of code can either belong to the main program or to a subroutine, but not both.

Please note that all contributions to explain xkcd may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see explain xkcd:Copyrights for details). Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel | Editing help (opens in new window)

Templates used on this page: