Talk:Goto

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computing (Rated Stub-class, Low-importance)
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Stub-Class article Stub  This article has been rated as Stub-Class on the project's quality scale.
 Low  This article has been rated as Low-importance on the project's importance scale.
 

Help Here![edit]

Can someone please explain the goto relation to object oriented programing specifically? It seems that it is a compromise between pro and con beliefs on using goto, but that is (my) layman's conjecture. Thanks! — Preceding unsigned comment added by 71.99.3.105 (talk) 23:58, 30 June 2011 (UTC)

Java and Goto[edit]

Because of the current popularity of Java, would it be appropriate to discuss the labeled break and labeled continue statements in this article? It has always seemed to me that these constructs, though rarely used, are gotos with restrictions as to where you can "go to". --Eraticus 23:12, 16 April 2007 (UTC)

The Complete Framework for Using Gotos in Java Programs[edit]

Does this belong here? Looks like a commercial promotion to me. Any other comments? (Personal POV: I mean apart from the bizzare idea of porting Fortran to Java without rewriting it; this is a joke, right?; the idea that adding jumps to Java would help; the idea that you would actually have something bug free at the end of it; the amazing amount of effort and hacks to get this into Java; why not leave it in fortran? (End personal POV) peterl 03:59, 6 July 2007 (UTC)

Assembly[edit]

The article is missing a section on GOTO in assembly language. In assembly (eg PIC ASM), there are no high-level constructs such as for/if-then-else/break etc. There are only: Call/Return, Goto (=Jump) and Conditional Jump (eg the pic's skipz/skipnz). Things such as if-elseif-else are built out of conditional jumps: practically every flow-control structure in assembly is a Goto. --RichardNeill 05:30, 24 July 2007 (UTC)

Well, in assembly there is no distinction between goto and non-goto branching. This is a distinction that can only made in higher level languages that have alternatives to "goto". Why would we need to cover "goto in assembly"? It's not even referred to as goto in assembly language. - Rainwarrior 05:51, 24 July 2007 (UTC)

Requested move[edit]

The following discussion is an archived discussion of the proposal. Please do not modify it. Subsequent comments should be made in a new section on the talk page. No further edits should be made to this section.

The result of the proposal was Move. Although the (Fortran) tradition is there, I don't see a compelling reason to override MOS:CAPS; the command is genericized enough in many programming languages. See also Category:Control flow.

  • GOTOGoto —(Discuss)— This is clearly the primary topic for Goto, and the computer-language usage is not especially capitalized. It should be named in normal case as other programming statements are. Please note that the talk page is currently at Talk:Goto (command) and also needs to be moved. —The way, the truth, and the light 00:34, 7 October 2007 (UTC)
  • Strong Oppose - Just because a few modern languages are case sensitive doesn't mean that the article should default to that usage, contrary to a wider and historical usage. Instead Goto should redirect to GOTO. Note also that the command is capitalised throughout the article. And wikt:GOTO is about the command. wikt:goto is not. - jc37 09:23, 7 October 2007 (UTC)
I did make that redirect. I am not arguing for case-sensitivity - rather, the title should not be, and therefore should use normal Wikipedia conventions to prefer lowercase. The former title of this page, Goto (command), is lowercase. Goto and GOTO simply mean the same thing. The way, the truth, and the light 22:52, 7 October 2007 (UTC)
No they aren't necessarily the same, per the wiktionary links I listed above. - jc37 20:27, 12 October 2007 (UTC)
  • Support - Wikipedia conventions dictate that article titles be title case. LordAmeth 07:24, 9 October 2007 (UTC)
  • Support. Per MOS:CAPS. Re article body, wouldn't <tt> be appropriate formatting for "goto"? ENeville 16:03, 12 October 2007 (UTC)
  • Comment - In reading over the pages, neither the MoS, nor "caps" list an example which apply to this. (Please take a moment and read the pages that you're linking to.) It's a command in programming languages (Assembly language, for example). See x86 instruction listings for examples of commands in upper case. - jc37 20:27, 12 October 2007 (UTC)
The above discussion is preserved as an archive of the proposal. Please do not modify it. Subsequent comments should be made in a new section on this talk page. No further edits should be made to this section.

NPOV mark on critcism section[edit]

The criticism section had been marked with NPOV. But no explanation was given. The section is well referenced, and the fact that is is criticism doesn't make it POV. Please explain if you want to add that marker back in. peterl (talk) 04:19, 29 January 2008 (UTC)

I don't think the NPOV tag was warranted either, but the writing was a bit awkward and did have a weasel word tag. I've tried rewriting several of the sentences to try to make it better. - Dmeranda (talk) 09:44, 29 January 2008 (UTC)

A working GOTO for Python[edit]

It was written as an April fool's joke, it works and includes a "comefrom" statement, but there is REALLY no need for it in the language ;)

http://entrian.com/goto/

A working GOTO for Java[edit]

An open-source licensed project called JavaGoto. Maybe it has some usefulness in teaching (what GOTO is and why not to use it). https://github.com/footloosejava/JavaGoto — Preceding unsigned comment added by 174.7.38.170 (talk) 04:22, 18 April 2014 (UTC)

It's GO TO in COBOL[edit]

Since there seems to be much ado over GOTO vs GoTo, goto, gOTo, etc., it must be important, so I think there should be some mention of the COBOL form being two words. Georget99 (talk) 20:14, 10 April 2009 (UTC)

That's not the only occurrence of GO TO. Commodore BASIC accepts both forms: GOTO is tokenized as 0x89; GO TO is tokenized as 0xCB 0xA4. Both forms are interpreted in exactly the same way. Devil Master (talk) 20:41, 28 July 2009 (UTC)

Linus Torvalds[edit]

Why on earth are we citing Linux Torvalds as an authority on this particular aspect of computer science? I've removed an extensive verbatim quote of an email he supposedly once sent to the kerneltrap mailing list (!). --TS 18:41, 11 December 2009 (UTC)

Linus is a experienced programmer, widely recognised in the computer sciences (NOTABILITY) - please check the wiki article on him for details. He IS an authority when it comes to programming, both C and machine code~, same can be said about his posts on kerneltrap. Also, his views represent a unorthodox stance vs goto usage, contrasting with what most "wannabe specialists" want to believe; representing every important view on the subject, regardless of Your personal preferences, was one of the main Wikipedia ideas. Either edit the form of the article or accept what's fact. DON'T DELETE just because you don't understand it, monopolizing an article is an extreme example of bad taste. Vaxquis (talk) 15:51, 30 January 2010 (UTC)
Torvalds is an experienced programmer, certainly, but you still don't explain why his opinion belongs in this article. He's an operating system kernel developer, not a language designer. Why is his opinion (which is tucked away in some posting on the Linux Kernel Mailing List) in this article? The mere fact that he has an opinion does not explain that. The mere fact that he has written operating system kernel code in C does not explain that. Can you explain that? --TS 17:03, 30 January 2010 (UTC)
because he's not a *theoretician*, but a notable programmer dealing with practical aspects of code creation. drawing the proper line between theory and practice in IT is obviously important, and he clearly shows the point that was clearly visible in older revisions of the page, dating up to 2001 (http://en.wikipedia.org/w/index.php?title=Goto&oldid=255242) - that gotos may be and often are a reasonable choice in programming. feel free to replace Torvalds' quote with any other *well known software designer's* or *notable programmer's* quote, stating what Torvalds said with as little words and so much precision as he did - i won't object to this, the choice of Linus (*not* Linux - you've made a typo there, mate) was made a priori, just because he fits perfectly for a person to state the unobvious obviousness of the usefulness and harmlessness of gotos... i'd say even more - throw out the quote if you feel that it doesn't clarify the point of the preceding statement; but AFAIR wikipedia is not encyclopedia - if we feel that Linus point of view on programming is unimportant just because he hasn't won the Turing Award, we may as well ditch Bill Gates and Eric S. Raymond's opinions on CS & IT for being worthless because the haven't the Neumann Medal. but, if you still insist:
  • In 1997 he received his Master degree (Laudatur Grade) from Department of Computer Science, University of Helsinki.
  • In 1998 he received an EFF Pioneer Award.[24]
  • In 1999 he received honorary doctor status at Stockholm University.
  • In 2000 he received honorary doctor status at University of Helsinki.[25]
  • In 2000 he was awarded the Lovelace Medal.[26]
  • In the Time magazine's Person of the Century Poll, Torvalds was voted at #17 at the poll's close in 2000.[27]
  • In 2001, he shared the Takeda Award for Social/Economic Well-Being with Richard Stallman and Ken Sakamura.
  • In 2004, he was named one of the most influential people in the world by the Time magazine article "Linus Torvalds: The Free-Software Champion" by Lawrence Lessig[28]
  • In the search for the 100 Greatest Finns of all time, voted in the summer of 2004, Torvalds placed 16th.
  • In August 2005, Torvalds received the Vollum Award from Reed College.[30]
  • In 2006, Time Magazine—Europe Edition named him one of the revolutionary heroes of the past 60 years.[32]
  • In 2008, he was inducted into the Hall of Fellows of the Computer History Museum in Mountain View, California.[33][34]
please do some research on these awards... Linus Torvalds simply IS somebody notable enough in CS for his opinions to matter. is that enough to meet your nota' criteria or should i search for more? Vaxquis (talk) 22:23, 30 January 2010 (UTC)
I don't think you need to use sarcasm, and in reference to your latest edit summary on this page, of course I'm prepared to wait for a response, so don't worry. I'm not asking you to give me a rundown of Torvalds' career. I'm asking you specifically what his opinion on the use of the goto, as expressed in a fairly obscure mailing list, is doing in this article. Why is it relevant? Citing these awards and whatnot does not go towards answering the question. --TS 22:32, 30 January 2010 (UTC)
QUOTE: because he's not a *theoretician*, but a notable programmer dealing with practical aspects of code creation. drawing the proper line between theory and practice in IT is obviously important, and he clearly shows the point that was clearly visible in older revisions of the page, dating up to 2001 (http://en.wikipedia.org/w/index.php?title=Goto&oldid=255242) - that gotos may be and often are a reasonable choice in programming. feel free to replace Torvalds' quote with any other *well known software designer's* or *notable programmer's* quote, stating what Torvalds said with as little words and so much precision as he did - i won't object to this, the choice of Linus (*not* Linux - you've made a typo there, mate) was made a priori, just because he fits perfectly for a person to state the unobvious obviousness of the usefulness and harmlessness of gotos.
if you need me to Ctrl+C Ctrl+V it a couple of times more, i'm always eager to help. just read it aloud, it's the exact answer to your exact question. if you don't see my point, just ask somebody [who?] to explain it to you - some [which?] people are better than me at explaining obviousness... Linus maybe?
I read it the first time. Could you now explain why you consider Linus Torvalds to be an authority on programming languages? It's all I want to know. --TS 11:14, 31 January 2010 (UTC)
Ctrl+C Ctrl+V

if you still insist: In 1997 he received his Master degree (Laudatur Grade) from Department of Computer Science, University of Helsinki. In 1998 he received an EFF Pioneer Award.[24] In 1999 he received honorary doctor status at Stockholm University. In 2000 he received honorary doctor status at University of Helsinki.[25] In 2000 he was awarded the Lovelace Medal.[26] (...) In 2004, he was named one of the most influential people in the world by the Time magazine article "Linus Torvalds: The Free-Software Champion" by Lawrence Lessig[28] (...) In August 2005, Torvalds received the Vollum Award from Reed College.[30] In 2006, Time Magazine—Europe Edition named him one of the revolutionary heroes of the past 60 years.[32] In 2008, he was inducted into the Hall of Fellows of the Computer History Museum in Mountain View, California.[33][34] please do some research on these awards...

they aren't given to random people with no knowledge of CS, and they are given to people both widely respected, acknowledged and influential. isn't that enough for someone's opinion on the subject to be notable enough to matter?

http://en.wikipedia.org/wiki/Wikipedia:Notability_(people)

it's quite easy to prove Linus Torvalds' notability in the field of programming. developing and maintaining the world's most known free-source operating system should be enough by itself;

so please, either prove that Torvalds SHOULD'T be considered an authority when it comes to CS in his field of interest (and low-level programming is DIRECTLY related to GOTO use - PLEASE do the research on your own, because the relation it's quite obvious to anybody with a basic knowledge of assembler/C/kernel programming), or declare the dispute closed.

I don't subscribe to the notability guideline precisely because it's so often misused (as it is here). In my opinion the statement of Torvalds, given off-the-cuff on a website devoted to kernel development in C, fits poorly with the scholarly opinions of Knuth and Dijkstra. The main problem, however, was an extensive verbatim quote (including email headers) from that email, which far outbalanced the entire section. I've remedied that problem and I'll leave it there. --TS 18:40, 31 January 2010 (UTC)


GOTO - isn't "break" and "continue" just an internal goto ( compiler supplies the label). Is a pointer a calculated goto ( ie GOTO variable - really old construction, apparently abandoned because it causes as much problems as pointers) —Preceding unsigned comment added by 159.105.80.141 (talk) 13:14, 19 May 2010 (UTC)

The referenced person is clearly used as an example which is helpful. Besides without links/ references everything would have to be fully explained (Ctrl+C , Cntrl+V) on every wiki page. This point/ argument is isomorphic to the article's argument on goto's controversy, and that is quite cute.

Unconditional[edit]

Goto should be described as an unconditional jump. A plain goto is not a branching statement. Only if goto is preceded by an if (or similar) it works in a conditional way. (or if it's a computed goto or any of the more exotic variants) — Preceding unsigned comment added by 88.112.175.168 (talk) 08:05, 25 September 2011 (UTC)

Criticism and Decline[edit]

Regarding the request for citations starting:

Some[which?] programming style coding standards prohibit...

Possible citations are

[1] "It is good programming style to use the break, continue, and return statement in preference to goto whenever possible."

[2] "Chapter 7: Centralized exiting of functions

Albeit deprecated by some people, the equivalent of the goto statement is used frequently by compilers..."

The python discussion about a Python goto is quite interesting [3] "This PEP is not a proposal to add GOTO to Python. GOTO allows a programmer to jump to an arbitrary block or line of code, and generally makes control flow more difficult to follow."


It might be helpful to rephrase the sentence:

Some programming style coding standards discourage... while some do not


ProgrammerMax (talk) 20:40, 6 April 2012 (UTC)


If the only reason why "goto" should not be use, is that the program can not be checked : it's not a good reason : optimized code is necessarily hard to check. Code is not designed to be checked, but to be the fastest and the shortest : with the best reuse of instruction, and the less redundancy of tasks (such as done/undone/done/undone). Goto is simply necessary. — Preceding unsigned comment added by 137.129.13.90 (talk) 16:18, 11 September 2012 (UTC)

Dijkstra didn't propose the title "goto considered harmful", it was Niklaus Wirth[edit]

Dijkstra claims that "goto considered harmful" was not the original title of his article. The title was changed by the editor, Niklaus Wirth.

Dijkstra tells the story in this video beginning at 4:22: http://www.youtube.com/watch?v=40CNRVHLt7A&feature=player_detailpage&list=PL7D42CB0A207D79B6#t=255s Prof. Edsger Dijkstra on "Structured Programming" at "Software Pioneers",sd&m Conference 2001, Bonn, Germany

I don't have time to transcribe the story now but it would be a good addition (and correction) to this article.

I haven't read the "considered harmful" paper in a while, but going by what Dijkstra says in the video, the paper is an analysis, not a criticism in the derogatory sense -- in which case the current wording of the wikipedia article is biased.

Ross bencina (talk) 05:38, 5 January 2013 (UTC)

Original title was "A Case Against the Goto Statement". You're kind of right on this one, Ross. AFAIR, it was along the lines you're talking about - the whole 'criticism' was the result of a style war that erupted *after* the article, not the article itself IMO. Still, Dijjie said in that article: "The go to statement as it stands is just too primitive, it is too much an invitation to make a mess of one's program."

It IS a negative criticism, but Dij says himself that it's his *opinion*, based on what he seen - not an arbitrary, scientific fact. And I'm with him on this one.

Further reading: Considered harmful

Vaxquis (talk) 17:31, 11 April 2013 (UTC)

Criticism and decline out of date statement[edit]

The section states that MISRA C Coding Standard prohibit the use of GOTO statements. This is not the case since MISRA2012:

  • MISRA C:2004 Rule 14.4 (required): The goto statement shall not be used
  • MISRA C:2012 Rule 15.1 (advisory): The goto statement should not be used

Simzer (talk) 15:33, 27 June 2013 (UTC)

Apple[edit]

Is Apples Security failure missing in the article? :) 87.78.122.110 (talk) 20:00, 23 February 2014 (UTC)

  1. ^ http://msdn.microsoft.com/en-US/library/b34dt9cd(v=VS.80).aspx
  2. ^ http://www.kernel.org/doc/Documentation/CodingStyle
  3. ^ http://www.python.org/dev/peps/pep-3136/