pTAL Conversion Guide
Pointers
pTAL Conversion Guide—527302-002
10-17
Operations on Addresses
Operations on Addresses
TAL
Addresses are 16-bit or 32-bit integers. Because an address is an integer, you can
perform any operation on an address that you can perform on a 16-bit or 32-bit integer.
pTAL
You can perform only these well-defined operations on addresses:
•
Assign constant values to pointers
•
Convert between address types
•
Increment and decrement addresses
•
Compare addresses
•
Compute the arithmetic difference between two addresses
Topics:
•
Storing Addresses in Pointers and Variables on page 10-17
•
Converting Between Addresses and Numbers on page 10-18
•
Implicit Conversions on page 10-20
•
Converting Between Address Types on page 10-22
•
Pointer Arithmetic on page 10-24
•
Using Addresses in Expressions on page 10-34
Storing Addresses in Pointers and Variables
TAL
Your program can store addresses into INT or INT(32) variables:
INT i;
INT .j;
i := @j; ! Store address from pointer j into i
pTAL
You can store an address into a variable only if the address is the same data type as,
or is convertible to, the data type of the variable into which you are storing the address.