pTAL Conversion Guide

Statements
pTAL Conversion Guide527302-002
15-12
DROP Statement
DROP Statement
The DROP statement removes either a label (from the symbol table) or a temporary
variable that was created by a USE statement.
TAL
A register allocated by a USE statement is accessible even after executing a DROP
statement, although such access is a result of the implementation of TAL and is not a
documented feature. Your program might execute a DROP statement explicitly, or it
might execute a DROP statement implicitly by returning from a procedure.
After executing a DROP statement—whether explicitly or implicitly—your TAL program
might still access the value in a register, either by issuing another USE statement or by
executing a CODE statement.
pTAL
After your code executes a DROP statement, either implicitly or explicitly, the value in a
variable created by a subsequent USE statement has no relationship to the value in a
variable declared in any previous USE statement.
GOTO Statement
The GOTO statement unconditionally transfers control to a labeled target statement
Topics:
Labels as Procedure Parameters on page 15-13
Branching From a Subprocedure to Its Containing Procedure on page 15-14
Overflow Traps in pTAL on page 15-15
Example 15-16. DROP Statement
PROC p;
BEGIN
INT save_i;
USE i; ! Allocate a register for i
FOR i := 1 TO 10 DO ! i is the control variable of the loop
BEGIN
...
END;
DROP i; ! Discontinue use of this register
USE i; ! Reuse same register
save_i := i;
END; ! Implicitly DROPs register for i