pTAL Conversion Guide

Data Allocation
pTAL Conversion Guide527302-002
5-10
Invalid Uses of the VOLATILE Attribute
Invalid Uses of the VOLATILE Attribute
You cannot specify VOLATILE when you declare a:
Structure
Substructure
Array
Example 5-7. Volatile Parameters
PROC p(i, j);
VOLATILE INT i, .j; ! Both i and j are always treated as
BEGIN ! volatile, independent of whether the
... ! actual parameters passed to p are
END; ! volatile
PROC q;
BEGIN
VOLATILE INT a;
VOLATILE INT .b;
INT c;
INT .d;
CALL p(a, b); ! a and b are read from memory because
! both specify VOLATILE
CALL p(c, d); ! c and d are not volatile and might use
! a value from a register if one is
! already in a register
! Within procedure p: a, b, c, and d
! are treated as volatile because both
! formal parameters, i and i, specify
END; ! VOLATILE
Example 5-8. Invalid Uses of the VOLATILE Attribute (page 1 of 2)
VOLATILE STRUCT s; ! Direct structure
BEGIN
INT i;
END
VOLATILE STRUCT .t; ! Indirect structure
BEGIN
INT i;
END
VOLATILE STRUCT .EXT u; ! Extended structure
BEGIN
INT i;
END