pTAL Reference Manual (H06.08+)
Built-In Routines
HP pTAL Reference Manual—523746-006
15-59
$LEN
$LEN
$LEN returns an INT value that is the length, in bytes, of a variable.
variable
is the identifier of a simple variable, array element, pointer, structure, or structure
data item.
The compiler reports an error if you apply the $LEN routine to a structure that consists
of an odd number of bytes, exclusive of a pad byte.
You can avoid this error by using one of the following solutions:
•
Declare explicitly a 1-byte filler item at the end of structures that consist of an odd
number of bytes.
•
Use $BITLENGTH on page 15-28 instead of $LEN.
The compiler reports an error if you apply $LEN to an UNSIGNED variable or structure
field. Use $BITLENGTH to obtain the length of an UNSIGNED variable or structure.
Example 15-48. $INTR Routine
INT rndnum;
REAL realnum := 12345E-2;
rndnum := $INTR (realnum); ! Return 123
pTAL privileged procedure No
Can be executed only by privileged procedures No
Sets condition code No
Sets $CARRY No
Sets $OVERFLOW No
Example 15-49. $LEN Routine
INT b;
INT a [0:11];
b := $LEN (a); ! Return 2
variable
( )
VST096.vsd
$LEN










