Revision [16923]

This is an old revision of KeyPgSizeof made by FxMwikki on 2013-08-29 16:37:55.

 

SIZEOF


Returns the size of a variable or type in bytes.

Syntax:
Sizeof ( variable | DataType DataType )

Description:
The Sizeof operator returns the number of bytes taken up by a variable or DataType DataType.
Different from KeyPgLen Len, when used with fixed-length strings (including fixed-length KeyPgZstring Zstrings and KeyPgWstring Wstrings) it will return the number of bytes they use, and when used with variable-length strings, it will return the size of the string descriptor.
Note: When used with arrays, Sizeof returns the size of a single element of the array. This differs from its behavior in C, where arrays could only be a fixed size, and sizeof() would return the number of it used.
For clarity, it is recommended that you avoid this potential confusion, and use Sizeof directly on an array element, rather than the whole array.
Remark: When used with a dereferenced z/wstring pointer, Sizeof always returns the number of bytes taken up by one z/wstring character (instead of 0 before fbc version 0.90).

Examples:
Print SizeOf(Byte) ' returns 1

Type bar
    a As Integer
    b As Double
End Type
Dim foo As bar
Print SizeOf(foo)



Dialect Differences:
Differences from QB:
See also:
Back to Miscellaneous
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode