Send Close Add comments: (status displays here)
Got it!  This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
Goto statement harmful


1. Goto statement harmful

2. Goto statement
It is usually considered bad form to use the goto statement in programming unless you have a really good reason. However, the goto statement is useful for understanding the operational semantics of a conditional and looping statements. Good programming style dictates that a goto statement never be used except to make up for a deficiency in the language, such as the lack of adequate looping constructs, error processing, or early exit from a procedure/function. Another use of the goto statement is in automatic translation of programs.

For example, suppose that a program needs to be written to automatically convert a program written in the FORTRAN programming language into a equivalent program written in another programming language. Many FORTRAN programs make use of the goto statement. The programmers job is much easier if the goto statements in the FORTRAN program can be directly translated into goto statements in the desired programming language.

3. Edgar Dijkstra
Edgar Dijkstra started the goto controversy.

4. Dijkstra: Goto controversy

5. Dijkstra: Goto controversy
A goto statement transfers control of a program from one place in a program to another place in a program.

Edger Dijkstra is famous, or infamous, depending on your point of view, for starting the entire goto statement controversy. Dijkstra started the controversy/war in 1968 that raged for more than 20 years and has not ended to this day.

6. Dijkstra: Nontrivial algorithms

7. Dijkstra: Nontrivial algorithms
Dijkstra says that a nontrivial problem is nontrivial and complexity is inherent in solving difficult problems. Anything that can make programs easier to understand (and more declarative) should be a welcome change.

8. End of page