pTAL Reference Manual (H06.08+)

Pointers
HP pTAL Reference Manual523746-006
10-16
Declaring Structure Pointers
Declaring Structure Pointers
The structure pointer declaration associates a previously declared structure with the
memory location to which the structure pointer points. You access data in the
associated structure by referencing the qualified structure pointer identifier.
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.
Example 10-13. Declaring and Initializing a Simple Pointer, Using $XADR
INT a[0:1]; ! 16-bit word-addressed array
STRING .EXT s := $XADR (a[0]); ! Extended simple pointer
! initialized with
! 32-bit byte address of a[0]
Example 10-14. Declaring and Initializing an Extended Simple Pointer
INT .EXT x[-100:100]; ! Array
INT .EXT x_ptr := @x[-5]; ! Extended simple pointer
! initialized with
! 32-bit byte address of x[-5]
VOLATILE
STRING
INT
( )
identifier referral
.
.EXT
.SG
.SGX
;
,
:=
initialization
VST677.vsd