Skip to main content

SA0115: Variables with data type UNION

Detects declarations of a UNION data type and variable declarations of the UNION type

Justification: The IEC 61131-3 standard does not include unions. The code is more easily portable without unions.

Importance: Low

Example 100. Example
TYPE A_UNION: 
UNION
    lrTemp : LREAL;
    liTemp : LINT;
END_UNION
END_TYPE
PROGRAM PLC_PRG
VAR
    aunionVar: A_UNION;
    liVar : LINT;
END_VAR
aunionVar.lrTemp := 0.123E-12;
liVar := aunionVar.liTemp;

Output in the Messages view:

  • sa_icon_message.png SA0115: Unions not allowed