TAL Programmer's Guide

Using Simple Pointers
Using Pointers
096254 Tandem Computers Incorporated 9–7
Figure 9-1. Allocating Simple Pointers
INT(32) .a[0:1];
INT b;
STRING .c[0:3];
INT .p1;
INT .p2 := @a;
INT .p3 := @b;
Global primary area
Global secondary area
. . .
200
408
Undefined
200
1
C[0] C[1]
C[2] C[3]
A[0]
A[1]
.A
.C
.P1
.P2
.P3
B
Contains word offset
Contains byte offset
G[200]
G[408]
(bytes)
G[204]
(words)
G[0]
G[1]
G[2]
G[3]
G[4]
G[5]
Address
397
Assigning Addresses
to Simple Pointers
Once you have declared a simple pointer, you can store a memory address in it by
using an assignment statement (even if you initialized the pointer with an address
when you declared it).
To assign an address to a pointer, specify the pointer identifier (prefixed by @),
followed by the assignment operator and an arithmetic expression that represents a
memory address. On the left side of the assignment operator, @ changes the address
contained in the pointer, not the value of the variable to which the pointer points.
You can also prefix @ to a variable on the right side of the assignment operator. If the
variable is a pointer, @ returns the address contained in the pointer. If the variable is
not a pointer, @ returns the address of the variable itself.