TAL Programmer's Guide

Using Simple Pointers
Using Pointers
9–6 096254 Tandem Computers Incorporated
You can initialize a local or sublocal extended simple pointer with the address of an
extended indirect array:
INT .EXT ext_array[0:99]; !Declare EXT_ARRAY
INT .EXT ext_ptr := @ext_array[5];
!Declare EXT_PTR; initialize it
! with address of EXT_ARRAY[5]
You can initialize a local or sublocal extended simple pointer with the 32-bit byte
address returned by the $XADR standard function for an array that has a 16-bit byte
address:
STRING byte_array[0:1]; !Declare BYTE_ARRAY to have
! 16-bit byte address
INT .EXT ext_ptr := $XADR(byte_array[0]);
!Declare EXT_PTR; initialize it
! with converted 32-bit byte
! address of BYTE_ARRAY[0]
You can initialize a local or sublocal extended simple pointer with the 32-bit byte
address returned by $XADR for an array that has a 16-bit word address:
INT word_array[0:1]; !Declare WORD_ARRAY to have
! 16-bit word address
STRING .EXT ext_ptr := $XADR(word_array[0]);
!Declare EXT_PTR; initialize it
! with converted 32-bit byte
! address of WORD_ARRAY[0]
Allocating Simple Pointers The compiler allocates a word of storage for each standard pointer and a doubleword
for each extended pointer.
The compiler does not allocate space for the data to which the pointer points. You
normally store the addresses of previously declared items in pointers.
Figure 9-1 shows example pointer declarations and the storage allocation that results.
(If you use BLOCK declarations, however, the compiler allocates storage as described
in Section 14, “Compiling Programs.”)