pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
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 Chapter 3 (page 46).
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.
Example 83 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;
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:
type
is any data type described in Chapter 3 (page 46).
identifier
is the identifier of the array.
range
lower-bound
is an INT constant expression (in the range -32,768 through 32,767) that specifies the
index (relative to the zeroth array element) of the first array element you want allocated.
Both lower and upper bounds are required.
upper-bound
is an INT constant expression (in the range -32,768 through 32,767) that specifies the
index (relative to the zeroth array element) of the last array element you want allocated.
Both lower and upper bounds are required.
Declaring Arrays in Structures 143