Purpose |
Return the logical length of a variable, User-Defined Type, or Union. |
Syntax |
y& = LEN(target) |
Remarks |
If target is a
When used with pointers, LEN returns a value of
4, since a
target
can also be any other variable type, including
When measuring the size of a padded (aligned) UDT structure with the LEN (or SIZEOF) statement, the measured length includes any padding that was added to the structure. For example, the following UDT structure: TYPE LengthTestType DWORD a AS INTEGER END TYPE ... DIM abc AS LengthTestType x& = LEN(abc) Returns a length of 4 bytes in x&, since the UDT was padded with 2 additional bytes to enforce DWORD alignment. Note that the LEN of individual UDT members returns the true size of the member without regard to padding or alignment. In the previous example, LEN(abc.a) returns 2. |
See also |
|
Example |
DIM p AS BYTE POINTER ByteLen = LEN(p) ' size of a pointer = 4 bytes ByteLen = LEN(@p) ' size of byte (target) = 1 byte |