pTAL Conversion Guide

Pointers
pTAL Conversion Guide527302-002
10-33
Pointer Arithmetic
Example Revisited
The following example was given earlier in this topic:
INT .x; ! Pointer
@x := (@x + 3) / 4 * 4; ! Round @x up to next 4-byte address
As noted, this example works correctly in TAL but not in pTAL because pTAL does not
support multiplication or division on address types. Figure 10-4 on page 10-33
illustrates this case.
Example 10-14. Abbreviated Comparisons
TAL
INT .p;
INT .EXT .q;
IF @p THEN ... ! Equivalent to "IF @p <> 0 THEN ..."
IF NOT @p THEN ... ! Equivalent to "IF @p = 0 THEN ..."
IF @q <> 0D THEN ... ! Must specify 0D
IF NOT @q = 0D THEN ... ! Must specify 0D
pTAL
INT .p;
INT .EXT q;
IF @p THEN ... ! Equivalent to "IF @p <> 0 THEN ..."
IF NOT @p THEN ... ! Equivalent to "IF @p = 0 THEN ..."
IF @q THEN ... ! Equivalent to "IF @q <> 0D THEN ..."
IF NOT @q THEN ... ! Equivalent to "IF @q = 0D THEN ..."
Figure 10-4. An Invalid Arithmetic Expression in pTAL
@x := (@x + 3) / 4 * 4;
WADDR
WADDR
WADDR
INT
INT
INT
Error
VST030.vsd