You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
STruC++ implements the Structured Text (ST) language from IEC 61131-3. This document lists supported features and known gaps. The compiler also supports common CODESYS extensions where noted.
Data Types
Type
Status
Notes
BOOL
Supported
BYTE, WORD, DWORD, LWORD
Supported
SINT, INT, DINT, LINT
Supported
USINT, UINT, UDINT, ULINT
Supported
REAL, LREAL
Supported
TIME
Supported
Nanosecond precision, int64_t storage
DATE
Supported
TIME_OF_DAY
Supported
DATE_AND_TIME
Supported
LTIME, LDATE, LTOD, LDT
Supported
64-bit time types with nanosecond precision
STRING
Supported
Parameterized length: STRING(N), default 254
WSTRING
Supported
Parameterized length: WSTRING(N)
CHAR, WCHAR
Supported
Derived Types
Type
Status
Notes
TYPE ... END_TYPE
Supported
Type aliases
STRUCT ... END_STRUCT
Supported
With nested structs
Enumerations
Supported
With optional base type
ARRAY (1D)
Supported
Arbitrary bounds: ARRAY[1..10] OF INT
ARRAY (2D)
Supported
ARRAY[1..3, 1..4] OF REAL
ARRAY (3D)
Supported
ARRAY[1..3, 1..4, 1..5] OF INT
ARRAY[*] (VLA)
Supported
Variable-length array parameters
Subranges
Supported
Runtime validation
REF_TO
Supported
IEC reference type (explicit dereference)
REFERENCE_TO
Supported
CODESYS reference type (implicit dereference)
POINTER TO
Supported
CODESYS pointer type with dereference via ^
Not Implemented
Type
Notes
UNION
CODESYS extension
Program Organization Units
POU
Status
Notes
PROGRAM
Supported
With CONFIGURATION/RESOURCE/TASK structure
FUNCTION
Supported
With return type, all parameter modes
FUNCTION_BLOCK
Supported
Instantiation, invocation, member access
INTERFACE
Supported
Method and property signatures
Variable Declarations
Feature
Status
Notes
VAR
Supported
Local variables
VAR_INPUT
Supported
Input parameters
VAR_OUTPUT
Supported
Output parameters
VAR_IN_OUT
Supported
Pass-by-reference parameters
VAR_EXTERNAL
Supported
External references to VAR_GLOBAL
VAR_GLOBAL
Supported
Global variables
CONSTANT
Supported
Compile-time constants
RETAIN
Supported
Tracked in retain variable table
NON_RETAIN
Supported
AT %IX0.0
Supported
Located variables (I/Q/M areas, X/B/W/D/L sizes)
Multiple names
Supported
a, b, c : INT := 0;
Initialization
Supported
:= expression
Operators and Expressions
Category
Operators
Status
Arithmetic
+, -, *, /, MOD, **
Supported
Comparison
=, <>, <, >, <=, >=
Supported
Logical
AND, OR, XOR, NOT
Supported
Bitwise
AND, OR, XOR, NOT (on bit types)
Supported
Bit shift
SHL, SHR, ROL, ROR
Supported
Assignment
:=
Supported
Reference assign
REF=
Supported
Dereference
^, DREF()
Supported
Reference
REF()
Supported
Parentheses
( )
Supported
Function call
name(args)
Supported (positional + named)
Method call
obj.method(args)
Supported
Array access
arr[i], arr[i, j]
Supported
Field access
struct.field
Supported
Typed literals
INT#5, DINT#42, REAL#3.14
Supported
NEW
__NEW(type), __NEW(type, size)
Supported
DELETE
__DELETE(ptr)
Supported
Control Structures
Structure
Status
Notes
IF / ELSIF / ELSE / END_IF
Supported
FOR / TO / BY / DO / END_FOR
Supported
With optional BY (step)
WHILE / DO / END_WHILE
Supported
REPEAT / UNTIL / END_REPEAT
Supported
CASE / OF / END_CASE
Supported
Integer, bit, and enum selectors
EXIT
Supported
Break from loop
RETURN
Supported
Early return from POU
OOP Extensions
Feature
Status
Notes
Methods
Supported
On FUNCTION_BLOCK, with return types
Properties (GET/SET)
Supported
Virtual getter/setter methods in C++
Inheritance (EXTENDS)
Supported
Single inheritance
Interfaces (IMPLEMENTS)
Supported
Multiple interfaces, generates C++ abstract classes
ABSTRACT
Supported
Abstract FB (no instantiation) and abstract methods (pure virtual)
FINAL
Supported
Sealed FB and methods
OVERRIDE
Supported
Method override with C++ override specifier
PUBLIC/PRIVATE/PROTECTED
Supported
Access modifiers
THIS
Supported
Self-reference in methods
Standard Functions
All IEC 61131-3 standard functions are implemented in the C++ runtime: