pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
Example 92 Assigning Addresses to Pointers in Structures
STRUCT .s1;
BEGIN
INT var1;
INT var2;
END;
STRUCT .s2;
BEGIN
INT .std_ptr (s1);
INT .EXT ext_ptr (s1);
INT .EXT32 ext32_ptr (s1);
INT .EXT64 ext64_ptr (s1);
END;
PROC g MAIN;
BEGIN
@s2.std_ptr := @s1;
@s2.ext_ptr := $XADR(s1);
@s2.ext32_ptr := $WADDR_TO_EXTADDR(@s1);
@s2.ext32_ptr := $XADR(s1);
@s2.ext32_ptr := $XADR32(s1);
@s2.ext64_ptr := $WADDR_TO_EXTADDR(@s1);
@s2.ext64_ptr := $XADR32(s1);
@s2.ext64_ptr := $XADR64(s1);
END;
Declaring Structure Pointers in Structures
A structure pointer is a variable that contains the address of a structure. When you declare a
structure pointer inside a structure, the form is:
VOLATILE
specifies that the value of this variable must be maintained in memory, not in a register. Each
reference to a VOLATILE data item causes the data item to be read or written to memory even
when code is optimized. Based on the order of reads and writes in the source code, VOLATILE
also causes that precise order of memory references to be preserved, again, when code is
optimized.
STRING
is the STRING attribute.
Declaring Structure Pointers in Structures 151