pTAL Reference Manual (H06.08+)

Expressions
HP pTAL Reference Manual523746-006
5-12
Extended Addresses
Extended Addresses
The following rules apply when you compare extended addresses (EXTADDRs):
Use signed relational operators to compare extended addresses. Unsigned
operators are not valid.
If you compare an extended address to a constant, the constant must be a 32-bit
integer.
Nonextended Addresses
The following rules apply when you compare nonextended addresses:
Use unsigned relational operators ( '<', '=', '>', '<=', '<>', '>='), a signed equality
operator (=), or a signed inequality operator (<>) to compare nonextended
addresses. The signed and unsigned equality operators produce the same results.
Similarly, the signed and unsigned inequality operators produce the same results.
Do not compare nonextended addresses using signed operators that test for
greater than or less than (<, <=, >, >=).
Valid comparisons:
INT .p, .q;
IF @p = 0 THEN ...
IF @p <> 0 THEN ...
IF @p = @q THEN ...
Both operands must have the same address type:
STRING .s;
BADDR .b;
IF @s = b THEN ... ! OK: @s is BADDR, b is BADDR
IF @s = @b THEN ... ! ERROR: @s is BADDR, @b is WADDR
Example 5-1. Extended Addresses
EXTADDR e;
INT .EXT i;
IF e < @i THEN ... ! OK: e and @i are both EXTADDR
IF @i >= 0D THEN ... ! OK: @i is EXTADDR, 0D is 32 bits
IF e = 0D THEN ... ! OK
IF e <> 0D THEN ... ! OK
IF e THEN ... ! OK
IF NOT e THEN ... ! OK
IF e > i THEN ... ! ERROR: e is EXTADDR, i is INT
IF e '<' @i THEN ... ! ERROR: Unsigned operators are not valid
! with EXTADDRs