pTAL Reference Manual (H06.08+)

Structures
HP pTAL Reference Manual523746-006
9-40
Declaring Simple Variables in Structures
Declaring Simple Variables in Structures
The simple variable declaration associates a name with a single-element data item.
When you declare a simple variable 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.
type
is any data type described in Section 3, Data Representation.
identifier
is the identifier of the simple variable.
You cannot initialize a simple variable when you declare it inside a structure. You can
subsequently assign a value to the simple variable by using an assignment statement.
Declaring Arrays in Structures
An array declaration associates an identifier with a collectively stored set of elements
of the same data type. When you declare an array inside a structure, the form is:
Example 9-32. Simple Variables Within a Structure
STRUCT .inventory[0:49]; ! Declare definition structure
BEGIN
INT item; ! Declare three simple variables
FIXED(2) price; ! within structure layout
INT quantity;
END;
,
;
VST705.vsd
VOLATILE
type
identifier
type
;
,
VST201.vsd
rangeidentifier