pTAL Reference Manual (H06.08+)
LITERALs and DEFINEs
HP pTAL Reference Manual—523746-006
6-2
Declaring Literals
constant
is one of the following:
•
A character string of 1 to 4 characters.
•
Any of the following numeric constant expressions whose value is not the
address of a global variable (global variables are relocatable during linking):
°
FIXED(n)
°
INT
°
INT(32)
°
REAL
°
REAL(64)
°
UNSIGNED(n)
If you omit any constants, the compiler supplies the omitted numeric constants. The
compiler uses unsigned arithmetic to compute the constants it supplies:
•
If you omit the first constant in the declaration, the compiler supplies a zero.
•
If you omit a constant that follows an INT constant, the compiler supplies an INT
constant that is one greater than the preceding constant. If you omit a constant that
follows a constant of any data type except INT, an error message results.
You access a LITERAL constant by using its identifier in declarations and statements.
The compiler does not allocate storage for LITERAL constants. It substitutes the
constant at each occurrence of the identifier.
Example 6-1. Literal Declarations (page1of2)
All constants specified:
LITERAL true = -1,
false = 0,
buffer_length = 80,
table_size = 128,
table_base = %1000,
entry_size = 4,
timeout = %100000D,
CR = %15,
LF = %12;
All constants supplied by compiler:
LITERAL a, ! Compiler assigns 0
b, ! Compiler assigns 1
c; ! Compiler assigns 2










