The operator is an extension of the IEC 61131-3 standard.
The operator is used for defining the number of bytes that are required by the variable
x
. The operator SIZEOF
always yields an unsigned value. The type of return variable adapts to the detected
size of the variable x
.
In compiler version 3.5.16.0 and higher, the operator XSIZEOF
should be used instead of this operator.
Return value of |
Data type of the constant which CODESYS uses implicitly for the detected size. |
---|---|
0 <= size of x < 256 |
|
256 <= size of x < 65536 |
|
65536 <= size of x < 4294967296 |
|
4294967296 <= size of x |
|
Examples
Result in var1
: 10
.
ST:
arr1 : ARRAY[0..4] OF INT; var1 : INT;
var1 := SIZEOF(arr1); (* var1 := USINT#10; *)
See also