Topic: termination of control unit

topics > computer science > programming > Group: program control

repetitive control

defining a process
exception handling by termination
generalized repetition
goto statement
return from procedure
program blocks for control


Program control often applies to statement blocks where entrance is controlled and exit is at block's end. Explicit termination reduces the need for internal gotos. The standard format is: exit/leave/quit identifying-name-for-block value-for-block where each component is optional. Loop structures provide the most commonly exited blocks, but all control structures may find exit statements useful. Bochmann (QuoteRef: bochGV7_1973) describes an interesting extension where each unit includes a case statement for how the unit was terminated. The mode of termination can be seen as an exception which is explicitly signaled and handled. This structure becomes a universal control structure by combining repetition with selection and sequence. (cbb 5/80)

While 'exit' statements add conceptual power, they can be hidden inside a block. Other debates are allowing named exits or multi-level exits. (cbb 1/93)

Subtopic: process exit up

Quote: in NIL, when a process terminates, it sends an obituary message to its owner on a specified port [»stroRE5_1985]
Quote: Unix 'exit' terminates a process, destroys its image, closes its files, and generally obliterates it [»ritcDM7_1978a]
Quote: if an upcall fails, need to recover the calling task; the simple solution is to fail; i.e., tasks are expendable [»clarDD12_1995]

Subtopic: loop break or continue up

Quote: C's break statement terminates the immediately enclosing while, for, do, or switch [»ritcDM7_1978c]
Quote: C's continue statement initiates the next iteration of the immediately enclosing loop [»ritcDM7_1978c]
Quote: loop exits can allow specialized terminations indicated by a label [»bochGV7_1973, OK]

Subtopic: labeled exit statement up

QuoteRef: wulfWA10_1971 ;;49 feels that leave labeled-unit better than leaveloop etc.
QuoteRef: bochGV7_1973 ;; Wulf on Bliss: LEAVE name-of-program-section-to-leave
QuoteRef: zahnCT_1974 ;;174 until no_more_data do ... if eof then no_more_data ... this does the event exiting

Subtopic: exit statement up

Quote: in paper solutions with looping constructs, 75% had only a terminating condition [»paneJF2_2001]
Quote: in Kosaraju's control structure hierarchy, 'exit' statements added power to D and D' structures
QuoteRef: wegnE11_1973 ;;704 "It is sufficient to allow an action to complete the execution of any action in which it is contained.
Quote: an exit statement is like a 'signal' except that it raises an condition that is handled in the current procedure activation [»liskBH11_1979]
QuoteRef: wegbB2_1974 ;;42 conditional exits in EL1 by boolean-expression => value-of-exit
QuoteRef: wileDS11_1973 ;;36 else exit sequence (exs) terminates sequence when argument is empty otherwise its value is its argument (do while)
QuoteRef: wileDS11_1973 ;;37 then exit sequence (txs) terminates sequence and includes argument in result when arg is non-empty. otherwise returns nil (do until).
QuoteRef: wulfWA12_1971 ;;786 can exit any unit and return the value of that unit e.g., exitblock exp. or exitloop exp or return exp. of functions

Subtopic: tail recursion up

Quote: recall(p,x) is for simplifying program design; like recursion [»thimH2_1980]
Quote: recall(p,x) is equivalent to leave(p,p(x)); it replaces the most recent activation with a new one [»thimH2_1980]

Subtopic: exit syntax up

Quote: if a second exit is added to a loop, Programmers_Assistant embeds the loop in a conditional and notifies the programmer of the additional level [»wateRC1_1982]

Subtopic: problems with exit/break/etc. up

Quote: the need for high level control structures such as 'exit' statements is not proven [»ledgHF11_1975]
Quote: internal 'exit' statements in a control structure can be hidden in the code yet are very important

Related Topics up

Group: repetitive control   (7 topics, 117 quotes)

Topic: defining a process (23 items)
Topic: exception handling by termination (16 items)
Topic: generalized repetition (16 items)
Topic: goto statement (25 items)
Topic: return from procedure (9 items)
Topic: program blocks for control
(20 items)

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