pTAL Conversion Guide

Pointers
pTAL Conversion Guide527302-002
10-32
Pointer Arithmetic
Comparing PROCADDRs to PROCPTRs (pTAL)
You can compare PROCADDR addresses to PROCPTR addresses for equality and
inequality:
Rules for comparing PROCADDR addresses to PROCPTR addresses:
You must use either:
°
Unsigned equal operator ('=')
°
Signed equal operator (=)
°
Unsigned not equal operator ('<>')
°
Signed not equal operator (<>)
The result of comparing the addresses of different procedures is always “not
equal”, but the result of comparing two addresses of the same procedure is not
always “equal.”
Abbreviated Comparisons
In both TAL and pTAL, you can test a pointer for a nonzero value without specifying the
constant zero.
TAL: You cannot test an INT(32) pointer for a nonzero value without specifying the
constant zero. You must explicitly specify the zero (0D).
pTAL: You can test an EXTADDR pointer for a nonzero value without specifying the
constant zero:
Example 10-12. Comparing Addresses to Constants (pTAL)
STRUCT .s[0:99];
BEGIN
WADDR next;
END;
PROC p1;
BEGIN
INT .p(s);
IF p.next <> %HFFFF THEN ! Compare WADDR to NIL value
@p := p.next;
END;
Example 10-13. Comparing PROCADDRs to PROCPTRs (pTAL)
PROCADDR pa;
PROCPTR pp;
END PROCPTR;
IF @pp '=' pa THEN ... ;