pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
Comparing Addresses to Addresses
You can compare addresses only if both addresses are the same address type, except that:
• SGBADDR and SGXBADDR are interchangeable with one another
• SGWADDR and SGXWADDR are interchangeable with one another
You must use signed relational operators (<, =, >,<=, <>, >=) to compare EXTADDR, EXT32ADDR,
and EXT64ADDR addresses. For all other address types, you must use unsigned relational operators
(‘<‘, ‘=’, ‘>’, ‘<=’, ‘<>’, ‘>=’), or signed equal (‘=’) or signed not equal operators (‘<>’).
The result of comparing two addresses is an INT value that indicates whether the relationship is
true (nonzero) or false (zero).
You can test the condition code after an IF statement that compares two addresses only if certain
conditions are met. These conditions are described in Chapter 13 (page 234).
Comparing Addresses to Constants
You can compare a BADDR, WADDR, SGBADDR, SGWADDR, SGXBADDR, or SGXWADDR
address to a 16-bit constant value. The requirements for Comparing Addresses to Addresses
(page 56) also apply to comparing addresses to constants.
Comparing Procedure Addresses and Procedure Pointers
You can compare PROCADDR, PROC32ADDR, and PROC64ADDR addresses with PROCPTR,
PROC32PTR, and PROC64PTR addresses for equality and inequality. The result of comparing the
addresses of two different procedures is always “not equal,” but the result of comparing the two
addresses of the same procedure is not always “equal.”
NOTE: The address types and procedure pointers, PROC32ADDR, PROC64ADDR, PROC32PTR,
and PROC64PTR are available in the 64-bit addressing functionality added to the EpTAL compiler
starting with SPR T0561H01^AAP. For more information, see Appendix E, “64-bit Addressing
Functionality” (page 531).
Testing a Pointer for a Nonzero Value
You can test a pointer for a nonzero value without specifying the constant zero. For example, if i
is declared:
int .i;
Then these two statements are equivalent:
IF @i THEN ...
IF (@i <> 0) ...
You can test an EXTADDR or EXT32ADDR pointer for a nonzero value without specifying the
constant zero. For example, if j is declared:
int.EXT j;
INT .EXT32 k;
Then these four statements are equivalent:
IF @j THEN ...
IF @k THEN ...
IF @j <> 0D THEN ...
IF @k <> 0D THEN ...
You can test an EXT64ADDR pointer for a nonzero value without specifying the constant zero. For
example, if m is declared, then these two statements are equivalent:
IF @m THEN ...
IF @m <> 0F THEN ...
56 Data Representation