Map
Index
Random
Help
Topics
th

Topic: goto statement

topics > computer science > programming > Group: program control



Topic:
continuation
Topic:
dynamic code modification
Topic:
flow diagrams and flow charts
Topic:
hypertext as unstructured information
Topic:
program blocks for control
Topic:
programming style
Topic:
state machine
Topic:
structured programming
Topic:
termination of control unit

Summary

In 1980, the old-fashioned goto was still in heavy use. It is the sequential representation for non-sequential processes. Goto's have an optional guard and a target. The target can be a fixed label, a relative label, the end of a block, or a patterned goal. Gotos are particularly useful for error handling when catch/throw is not available.

Structured programming was largely developed to limit the use of gotos to exits from embedded structures. The justification is that uncontrolled branching hides a program's flow of control. The experimental evidence for small programs is uneven but maintaining large uncontrolled programs convinces one of the need for constraint.

Flow charts and implementation inheritance also lead to unstructured designs. (cbb 5/80 4/98)

Subtopic: goto for exceptions up

Quote: exceptions should be handled separately from the normal case; good use of a restricted goto [»backRJ11_1979]
Quote: need goto for abnormal exits and non-returning transfers between modules [»frieFL1_1974, OK]
Quote: most programmers in the Coding War Games restricted gotos to emergency exits and loop exits [»demaT5_1989]

Subtopic: goto too primitive up

Quote: the goto statement is just too primitive; it is an invitation to make a mess of one's program [»dijkEW3_1968]
Quote: every program can be written as a recursive function without assignments or gotos [»dijkEW5_1965]
Quote: programs without gotos are shorter and more lucid [»dijkEW5_1965]

Subtopic: flow charting up

Quote: a C-- program is the textual description of a control-flow graph; a label names a node and a goto creates an edge to the node [»ramsN6_2000]
QuoteRef: cbb_1973 ;;flow charting does not show structure--is purely goto i.e., actually step back

Subtopic: goto as global transfer up

Quote: 12% of maintenance cost due to long goto statements to other COBOL paragraphs [»bankRD11_1993]
Quote: the problem with a goto statement is actually the label which can be jumped to from anywhere in the program [»levyEB11_1982]
Quote: a global transfer of control affects storage allocation and name bindings; invokes a new piece of program text [»lampBW_1974]
Quote: implementation inheritance is a bad idea that binds implementations together so that all classes must be understood together; like 'goto' statements [»oustJK3_1998]

Subtopic: goto as continuation up

Quote: a continuation is the state transformation from a command to the end of the program; thrown away for gotos; value of a label [»straC1_1974]

Subtopic: goto vs. if..then..else up

Quote: no difference in learning and performance between a goto language and flowcharts; both better than if..then..else programs [»millLA10_1978]
QuoteRef: bateD_1976 ;;74 Miller: on naive subjects found programs with goto's quicker in training time then programs with if-then-else
Quote: found if..then..else.. programs easier than if..goto.. programs [»simeME1_1973]

Subtopic: tail-call up

Quote: a C-- procedure may tail-call another procedure; deallocates the activation record and other resources [»ramsN6_2000]

Subtopic: examples up

Quote: equations may be numbered; the interpreter included a goto and conditional goto instruction [»laniJH1_1954]
QuoteRef: browSA11_1963 ;;654 geometric transfers: branch according to which check surface first reached tangency
QuoteRef: farbDJ1_1964 ;;26 gotos by /(label) f(label) s(label) for always, failure, success
Quote: in WADUZITDO, J:0 branches back to the last accept while J:n branches forward to the n'th program marker (a '*') [»kherL9_1978]
QuoteRef: thomK_1976 ;;380 goto x rewinds standard input, scans to (:x), and starts executing at next statement
QuoteRef: sammJE_1969 ;;269 goto at beginning of sentence deferred till end of sentence reached

Subtopic: hypertext links as gotos up

Quote: Hypertext links are gotos -- so documents will be hard to maintain [»browPJ11_1987]
Quote: Hypertext is links (i.e., goto's) and some hierarchy -- too unstructured
[»vandA7_1988]

Related Topics up

Topic: continuation (16 items)
Topic: dynamic code modification (15 items)
Topic: flow diagrams and flow charts (21 items)
Topic: hypertext as unstructured information (4 items)
Topic: program blocks for control (20 items)
Topic: programming style (47 items)
Topic: state machine (67 items)
Topic: structured programming (27 items)
Topic: termination of control unit
(22 items)

Updated barberCB 6/04
Copyright © 2002-2008 by C. Bradford Barber. All rights reserved.
Thesa is a trademark of C. Bradford Barber.