pTAL Conversion Guide

Equivalenced Variables
pTAL Conversion Guide527302-002
12-13
Declaring Pointers in Equivalenced Declarations
If you declare b and then declare a, the pTAL compiler does not report an error,
because a fits within the four bytes already allocated for b.
Declaring Pointers in Equivalenced Declarations
Note the following considerations when you declare indirect and extended pointers in
equivalenced declarations. The rules are also presented in Table 12-2 on page 12-14.
In an equivalenced declaration:
The address type of a STRING standard pointer is BADDR. The address type of all
other standard pointers is WADDR.
The address type of extended pointers is always EXTADDR, regardless of the data
type of the objects to which the pointer will refer.
Figure 12-4 on page 12-13 shows two examples of the data types associated with
pointers.
Table 12-2 on page 12-14 shows the object data type and address type. Use
Table 12-2 on page 12-14 to determine valid equivalenced declarations.
Example 12-9. Valid Equivalenced Structure Declaration
STRUCT b FIELDALIGN(AUTO);
BEGIN
INT i;
STRING j; ! pTAL adds a byte after j
END;
STRUCT a FIELDALIGN(SHARED2) = b;
BEGIN
STRING i;
STRING j;
STRING k;
END;
Figure 12-4. The Object and Address Types of a Pointer
12345
"ABCDEFGHIJ"
INT .EXT a;
Object Data Type: INT
Address Type: EXTADDR
Object Data Type: STRING
Address Type: BADDR
STRING .b;
VST124.vsd