pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
7 Simple Variables
A simple variable is a single-element data item of a specified data type that is not an array, a
structure, or a pointer. After you declare a simple variable, you can use its identifier in statements
to access or change the data contained in the variable. You must declare variables before you
use them.
This section defines the syntax for declaring simple variables. The declaration determines:
• The kind of values the simple variable can represent
• The amount of storage the compiler allocates for the variable
• The operations you can perform on the variable
• The byte or word addressing mode of the variable
• The direct or indirect addressing mode of the variable
• How the compiler allocates storage for simple variables
• How you access the variables
Topics:
• Declaring Simple Variables (page 103)
• Specifying Simple Variable Address Types (page 105)
• Initializing Simple Variables With Numbers (page 105)
• Initializing Simple Variables With Character Strings (page 105)
• Examples (page 105)
Declaring Simple Variables
The simple variable declaration associates an identifier with a single-element data item and
optionally initializes it.
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 one of the following data types:
• BADDR
• CBADDR
• CWADDR
Declaring Simple Variables 103