TAL Programmer's Guide

Declaring Redefinitions
Using Structures
8–24 096254 Tandem Computers Incorporated
You can declare new substructure SS to redefine array A and then declare simple
variable V to redefine substructure SS as follows:
STRUCT .st;
BEGIN
INT a[0:1]; !Declare array A
STRUCT ss = a; !Redefine A as substructure SS
BEGIN
INT x;
INT y;
END;
INT(32) v = ss; !Redefine SS as V
END;
Size of Substructure Redefinitions
The new substructure must be of the same size or smaller than the previous item:
394
NUM
STR / / /
SUB1 SUB2
STRUCT str;
BEGIN
STRUCT sub1; !Declare SUB1
BEGIN
INT num;
END;
STRUCT sub2 = sub1; !Redefine SUB1 as SUB2
BEGIN
STRING str;
END;
END;
If the new substructure is larger than the previous item, the compiler issues a warning:
STRUCT str2;
BEGIN
STRUCT sub1; !Declare SUB1
BEGIN
STRING str1;
END;
STRUCT sub2 = sub1; !Redefine SUB1 as SUB2, which is
BEGIN ! larger; compiler issues warning
INT int1;
END;
END;
STR1 / / /
INT1
395
SUB1
SUB2