|
Dictionary:
go-to (gō'tū') |
| 5min Related Video: go-to |
| Idioms: go to |
1.
See going to.
2.
Also,
go toward. Contribute to a result, as in Can you name the bones that go to make the arms and legs? or The director has a good eye for seeing what will go toward an entire scene. [c. 1600]
3.
Begin, start, as in By the time she went to call, she'd forgotten what she wanted to say. The related idiom
go to it means "get started, get going." P.G. Wodehouse used it in Louder & Funnier
(1932): "Stoke up and go to it."
[First half of 1700s]
| WordNet: go to |
The verb has 2 meanings:
Meaning #1:
move, travel, or proceed toward some place
Synonyms: repair to, resort to
Meaning #2:
be present at (meetings, church services, university), etc.
Synonym: attend
| Wikipedia: Goto |
GOTO is a statement found in many computer programming languages. It is a combination of the English words go and to. It performs a one-way jump to another line of code. The jumped-to locations are usually identified using labels, though some languages use line numbers. At the machine code level, a goto is a form of branch or jump statement.
Many languages support the goto statement, and many do not. In Java, goto is a reserved word, but is unusable.[1][2]
The structured program theorem proves that the availability of the goto statement is not necessary to write programs; some combination of the three programming constructs of sequence, selection/choice, and repetition/iteration are sufficient to perform any computation.
Contents |
goto label
The goto statement is often combined with the if statement to cause a conditional transfer of control.
IF condition THEN goto label
Programming languages impose different restrictions with respect to the destination of a goto statement. For example, in the C programming language it is not allowed to jump to a label contained within another function.[3] The setjmp/longjmp functions provide support for non-local gotos.
The 1960s and 1970s saw computer scientists move away from GOTO statements in favor of the "structured programming" paradigm. Some programming style coding standards prohibit use of GOTO statements. Probably the most famous criticism of GOTO is a 1968 letter by Edsger Dijkstra called Go To Statement Considered Harmful.[4] In that letter Dijkstra argued that unrestricted GOTO statements should be abolished from higher-level languages because they complicated the task of analyzing and verifying the correctness of programs (particularly those involving loops). An alternative viewpoint is presented in Donald Knuth's Structured Programming with go to Statements [5] which analyzes many common programming tasks and finds that in some of them GOTO is the optimal language construct to use. Linus Torvalds also objects to Dijkstra's point of view, stating that GOTOs can be a useful language feature, improving program speed, size and code clearness at the same time, but only when used in a sensible way by comparably sensible programmer.[6]
From: Linus Torvalds Subject: Re: any chance of 2.6.0-test*? Date: Sun, 12 Jan 2003 11:38:35 -0800 (PST) On Sun, 12 Jan 2003, Rob Wilkens wrote: > > I'm REALLY opposed to the use of the word "goto" in any code where it's > not needed. I think goto's are fine, and they are often more readable than large amounts of indentation. That's _especially_ true if the code flow isn't actually naturally indented (in this case it is, so I don't think using goto is in any way _clearer_ than not, but in general goto's can be quite good for readability). Of course, in stupid languages like Pascal, where labels cannot be descriptive, goto's can be bad. But that's not the fault of the goto, that's the braindamage of the language designer. Linus
The conclusion that GOTO was an undesirable feature is evident in the design of some programming languages, including the Algol family especially Pascal and its derivatives. Niklaus Wirth retained the GOTO and statement labels to act as destinations of the GOTO in Pascal, but his design forced the programmer to declare labels at the very top of the block in which they occurred, before the declaration of constants used in the block.[7] Pascal does however allow a Case statement that is a multiway branch or conditional goto. Ada, largely based on Pascal, retained this requirement although it dropped the rigid ordering of declarations and used a different format for statement labels. [8]
Fortran introduced structured programming constructs in 1978 and in successive revisions the relatively loose semantic rules governing the allowable use of goto were tightened; the "extended range" in which a programmer could use a GOTO to enter and leave a still-executing DO loop was removed from the language in 1978,[9] and by 1995 several of forms of Fortran GOTO, including the Computed GOTO and the Assigned GOTO, had been deleted from the language.[10] Some successful modern programming languages, such as Java, Python and Ruby, lack the GOTO statement, though most provide some means of breaking out of a selection, or either breaking out of or moving on to the next step of an iteration.
In classical structured programming, three basic structures are used: sequence, repetition, and selection. Sequence is the execution of one program unit following another; repetition is the repeated execution of the same program unit until a desired program state is reached; and selection is the executing of one and only one of a fixed set of possible alternative program units depending on the program state. Here typically the "program unit" is a compound statement constructed in turn using the three basic structures.
Although these three control structures can all be hand-coded using gotos and ifs, the desire for clarity and efficient optimization led to the introduction and refinement of supporting structures such as (in Pascal) procedure and function blocks, while, repeat until, and for statements, and case statements.
In practice the need arose to refine this basic three-structure template, because the attempt to eliminate exceptional changes of control altogether generated a need for quite complex program state data, and language design had to adapt in order to reduce the combinatorial explosion. Typically the language designers provided a way to exit a structured unit prematurely (in C, break and continue). For handling exceptional situations, specialized exception handling constructs were added, such as try/catch/finally in Java.
In a paper delivered to the ACM conference in Seattle in 1977, Guy L. Steele summarized the debate over the GOTO and structured programming, and observed that procedure calls in the tail position of a procedure can be most optimally treated as a direct transfer of control to the called procedure, typically eliminating unnecessary stack manipulation operations. [11] Since such "tail calls" are very common in Lisp, a language where procedure calls are ubiquitous, this form of optimization considerably reduces the cost of a procedure call compared to the GOTO used in other languages. Steele argued that poorly implemented procedure calls had led to an artificial perception that the GOTO was cheap compared to the procedure call. Steele further argued that "in general procedure calls may be usefully thought of as GOTO statements which also pass parameters, and can be uniformly coded as [machine code] JUMP instructions", with the machine code stack manipulation instructions "considered an optimization (rather than vice versa!)".[11] Steele cited evidence that well optimized numerical algorithms in Lisp could execute faster than code produced by then-available commercial Fortran compilers because the cost of a procedure call in Lisp was much lower. In Scheme, a Lisp dialect developed by Steele with Gerald Jay Sussman, tail call optimization is mandatory.[12]
Although Steele's paper did not introduce much that was new to computer science, at least as it was practised at MIT, it brought to light the scope for procedure call optimization, which made the modularity-promoting qualities of procedures into a more credible alternative to the then-common coding habits of large monolithic procedures with complex internal control structures and extensive state data. In particular, the tail call optimizations discussed by Steele turned the procedure into a credible way of implementing iteration through tail recursion.
The influential languages Simula and Smalltalk were among the first to introduce the concepts of messages and objects. By encapsulating state data, object-oriented programming reduced software complexity to interactions (messages) between objects.
There are a number of different language constructs under the class of goto statements.
A computed GOTO (originally Fortran terminology) jumps to one of several labels based on the value of an expression. The ON ... GOTO statement in BASIC supports the computed GOTO and is useful for case-by-case branching, as in C's switch statement.[13] Some variants of BASIC support a computed GOTO that can be any line number, not just one from a list. For example, one could write GOTO i*1000 to jump to the line numbered 1000 times the value of a variable i (which might represent a selected menu option, for example).
Originally found in Fortran, this variant transfers control to a statement label which is stored in (assigned to) a variable.
Some C compilers (e.g., gcc) support goto with a label variable using the label value operator. The label value operator && returns the address of its operand, which must be a label defined in the current function or a containing function. The value is a constant of type void * and should be used only in a computed goto statement. The feature is an extension to C and C++, implemented to facilitate porting programs developed with GNU C.[14] This C extension is sometimes referred to as a Computed goto, but it has the semantics of an assigned goto.
A continuation is similar to a GOTO in that it transfers control from an arbitrary point in the program to a previously marked point. A continuation is more flexible than GOTO in those languages that support it, because it can transfer control out of the current function, something that a GOTO cannot do in most languages. In those language implementations that maintain stack frames for storage of local variables and function arguments, executing a continuation involves adjusting the program's call stack in addition to a jump. The longjmp function of the C programming language is an example of an escape continuation that may be used to escape the current context to a surrounding one. The Common Lisp GO operator also has this stack unwinding property, despite the construct being lexically scoped, as the label to be jumped to can be referenced from a closure.
In Scheme, continuations can even move control from an outer context to an inner one if desired. This almost limitless control over what code is executed next makes complex control structures such as coroutines and cooperative multitasking relatively easy to write.
In Perl, there is a variant of the goto statement that is not a traditional GOTO statement at all. It takes a function name and transfers control by effectively substituting one function call for another (a tail call): the new function will not return to the GOTO, but instead to the place from which the original function was called. Early versions of COBOL had the ALTER verb to accomplish this.
This entry is from Wikipedia, the leading user-contributed encyclopedia. It may not have been reviewed by professional editors (see full disclaimer)
| Shopping: go-to |
| Sahler, Leslie Jeanne (Quotes By) | |
| ascend | |
| fetch |
| Where is he going? Read answer... | |
| Where does it go to? Read answer... | |
| How can you get him to go out with you? Read answer... |
| What is it when you have to go? | |
| Can you go to it? | |
| Who is going out with? |
Copyrights:
![]() | Dictionary. The American Heritage® Dictionary of the English Language, Fourth Edition Copyright © 2007, 2000 by Houghton Mifflin Company. Updated in 2009. Published by Houghton Mifflin Company. All rights reserved. Read more | |
![]() | Idioms. The American Heritage® Dictionary of Idioms by Christine Ammer. Copyright © 1997 by The Christine Ammer 1992 Trust. Published by Houghton Mifflin Company. All rights reserved. Read more | |
![]() | WordNet. WordNet 1.7.1 Copyright © 2001 by Princeton University. All rights reserved. Read more | |
![]() | Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "Goto". Read more |