TAL Programmer's Guide
Using Labels
Using Procedures
096254 Tandem Computers Incorporated 11–49
In the following example, sublocal GOTO statements reference local labels in the
encompassing procedure. Future software platforms require that you declare local
labels to which sublocal GOTO statements refer:
PROC p;
BEGIN
LABEL a; !Declare label A
INT i;
SUBPROC s;
BEGIN
!Lots of code
GOTO a; !This branch is portable to future
! software platforms; label A is declared
GOTO b; !This branch is not portable; label B is
! not declared
END;
!Lots of code
a : i := 0;
!More code
b : i := 1;
!Still more code
END;
When a local label and a sublocal variable in a procedure have the same identifier and
that identifier is referenced within the subprocedure, the sublocal variable is accessed
instead of the label:
INT data;
PROC a; !Declare procedure A,
BEGIN ! which has global scope.
LABEL a; !Declare local label A.
SUBPROC sp;
BEGIN
INT a; !Declare sublocal variable A.
data := @a; !Assign address of sublocal A,
! not of procedure A or
END; ! local label A.
a:
CALL sp;
END;