ZBasic System Library
Function returning UnsignedInteger
The variable whose size, in bytes, is desired.
Note: SizeofU() is deprecated, in new code you should use SizeOf() instead which returns an
integral value compatible with all integral types.
This function returns the number of bytes constituting the supplied variable.
The primary purpose of this function is to allow writing code that is more easily maintained. For example,
instead of hard coding the size value to pass to the OpenQueue() subroutine, you can use
SizeOfU(queue) instead. When you change the size of the queue there will be no need to update the
When used with arrays, you may give the array name without any index parameters and SizeOfU() will
return the total number of bytes occupied by the array. Alternately, you may specify constant expressions
for all of the array dimensions and SizeOfU() will return the number of bytes occupied by a single
element of the array. This function is not particularly useful with sub-byte types (Bit and Nibble).
The SizeOfU() function also allows the argument to name one of the fundamental data types (except
String). In this case it returns the number of bytes comprising the type. For example,
SizeofU(Integer) returns the value 2.
Dim cnt as UnsignedInteger
Dim val as Single
Dim ia(1 to 20) as Integer
cnt = SizeOfU(val)
' result is 4
cnt = SizeOfU(ia)
' result is 40
This function is not available in BasicX compatibility mode.