TAL Programmer's Guide

Declaring Structure Pointers in Structures
Using Structures
096254 Tandem Computers Incorporated 8–19
Declaring Structure
Pointers in Structures
You can declare structure pointers within a structure or substructure. A structure
pointer is a variable in which you store the memory address of a structure, which you
can access with this structure pointer. The compiler allocates space for the pointer but
not for the data to which the pointer points.
Structure pointers can be standard or extended:
Standard (16-bit) pointers can access addresses in the current user data segment.
Extended (32-bit) pointers can access addresses in any segment, normally the
automatic extended data segment.
To declare a structure pointer, specify:
STRING or INT attribute as described in Table 8-5
The structure pointer identifier, preceded by an indirection symbol (. or .EXT)
A referral that provides the structure layout—enclose in parentheses the identifier
of an existing structure or structure pointer or of the encompassing structure
The following example declares STRUCT_A and STRUCT_B. STRUCT_B contains a
declaration for STRUCT_PTR, whose layout is the same as the layout of STRUCT_A:
STRUCT struct_a; !Declare STRUCT_A
BEGIN
INT a;
INT b;
END;
STRUCT struct_b; !Declare STRUCT_B
BEGIN
INT .EXT struct_ptr (struct_a); !Declare STRUCT_PTR
STRING a;
END;