pTAL Reference Manual (H06.03+)

Statements
HP pTAL Reference Manual523746-005
12-32
Destination Shorter Than Source
Destination Shorter Than Source
The compiler reports a warning when it can detect that there are more bytes in the
source of a move than in the destination of the move. For example, if the number of
bytes to move is a constant or constant expression whose value is larger than the
number of bytes in the destination. The compiler does not report a warning if the
destination is:
A global variable
A reference parameter
An array or an element of an array
If the number of bytes to move is a dynamic expression, the compiler reports a warning
only if the number of bytes in the source is greater than the number of bytes in the
destination. It cannot detect whether the number of bytes to move is too large.
Example 12-29. MOVE Statement Copying a Substructure
LITERAL copies = 3; ! Number of occurrences
STRUCT .s;
BEGIN
STRUCT s_sub[0:copies - 1]; ! Source substructure
BEGIN
INT a, b;
END;
END;
STRUCT .d (s); ! Destination substructure
! is within structure d
PROC p;
BEGIN
d.s_sub ':=' s.s_sub FOR copies ELEMENTS; !Byte move of three
END; ! substructure
! occurrences
Example 12-30. MOVE Statement With Destination Shorter Than
Source (page1of2)
INT g;
INT(32) m;
PROC p( r );
INT .r;