TAL Reference Manual

Statements
TAL Reference Manual526371-001
12-21
Examples of DROP Statements
Dropping Registers
You reserve index registers by issuing USE statements. When you no longer need a
reserved index register, drop (RVU) it by issuing a DROP statement. After you drop an
index register, do not use its identifier without issuing a new USE statement and
assigning a value to it.
If you do not drop all reserved index registers, the compiler automatically drops them
when the procedure or subprocedure completes execution.
If you reserve an index register for a FOR loop, do not drop the register within the
scope of the loop.
Examples of DROP Statements
1. This example uses and drops a label within a DEFINE declaration:
DEFINE loop =
BEGIN
lab: !Uses label identifier
IF a = b
THEN
GOTO lab; !Branches to label
DROP lab; !Frees label identifier for reuse
END #;
2. This example reserves, uses, and drops an index register:
LITERAL len = 100;
INT array[0:len-1]; !Declarations
USE x; !Reserves index register named X
FOR x := 0 TO len - 1 DO
array[x] := 0; !Uses register X to clear array
DROP x; !Drops register X