pTAL Guidelines for TAL Programmers
Coding Guidelines
pTAL Guidelines for TAL Programmers—527256-002
2-13
@ Operator Applied to Variables
Topics:
•
@ Operator Applied to Variables on page 2-13
•
32-Bit Addresses on page 2-14
•
Addresses and Integer Variables on page 2-14
•
Address Variables on page 2-14
•
Addresses and Integer Expressions on page 2-15
•
Address Conversions on page 2-15
•
Address Arithmetic on page 2-16
•
Incrementing and Decrementing Pointers on page 2-17
•
Comparing Addresses to Addresses on page 2-19
•
Comparing Addresses to Constants on page 2-19
•
Addresses Are Indivisible on page 2-20
•
Addresses Are Absolute on page 2-20
•
Equivalenced Variables and Indirect Pointers on page 2-23
@ Operator Applied to Variables
Guideline: The data type of the value returned when you apply the @ operator to a
simple variable is the address type you get when you apply the @ operator to a pointer
of the same object type.
In TAL, if you apply the @ operator to a variable, the result is a value of type INT for
16-bit addresses, INT(32) for 32-bit addresses.
Example 2-8 on page 2-13 is also valid in pTAL, because the object data type of p is
INT and the address type of p is WADDR. The object data type of s is INT. The
address type of s is the same data type it would be if you declared s to be a pointer,
rather than a variable (that is, WADDR); therefore, you can store the address of s into
p because both are data type WADDR. Subsequent references to p reference the
same data as is referenced by s.
Example 2-8. Storing Variable Address in Pointer
INT .p; ! Declare pointer
INT s; ! Declare variable
@p := @s; ! Store address of s into pointer p