pTAL Reference Manual (H06.08+)

Expressions
HP pTAL Reference Manual523746-006
5-2
Data Types of Expressions
Topics:
Data Types of Expressions on page 5-2
Operator Precedence on page 5-3
Arithmetic Expressions on page 5-5
Signed Arithmetic Operators on page 5-6
Unsigned Arithmetic Operators on page 5-8
Comparing Addresses on page 5-11
Constant Expressions on page 5-14
Conditional Expressions on page 5-15
Special Expressions on page 5-20
Bit Operations on page 5-31
Data Types of Expressions
The result of an expression can be any data type or address type except STRING or
UNSIGNED. The compiler determines the data type of the result from the data type of
the operands in the expression. All operands in an expression must have the same
data type, with the following exceptions:
An INT expression can include STRING, INT, and UNSIGNED(1-16) operands. The
system treats STRING and UNSIGNED(1-16) operands as if they were 16-bit
values. That is, the system:
°
Puts a STRING operand in the right byte of a 16-bit word and sets the left byte
to 0, with no sign extension.
°
Puts an UNSIGNED(1-16) operand in the right bits of a 16-bit word and sets
the unused left bits to 0, with no sign extension. For example, for an
UNSIGNED(2) operand, the system fills the 14 leftmost bits of the word with
zeros.
An INT(32) expression can include INT(32) and UNSIGNED(17-31) operands. The
system treats UNSIGNED(17-31) operands as if they were 32-bit values. The
system places an UNSIGNED(17-31) operand in the right bits of a doubleword and
sets the unused left bits to 0, with no sign extension. For example, for an
UNSIGNED(29) operand, the system fills the three leftmost bits of the doubleword
with zeros.
In all other cases, if the data types do not match, use the type transfer functions
described in Section 15, Built-In Routines.