Skip to main content

SA0036: Unused output variables

Detects the output variables of functions and function blocks which are not assigned within the respective function or function block.

Justification: Unused variables make a program less readable and maintainable. Unused variables unnecessarily fill memory and unnecessarily waste runtime during initialization.

Importance: Medium

PLCopen rule: CP24

Example 45. Example
FUNCTION_BLOCK FB_Afb
VAR_INPUT
    iIn1: INT;
    iIn2: INT;
END_VAR
VAR_OUTPUT
    iOut1: INT;
    iOut2: INT;
END_VAR
iOut1 := iIn1 + iIn2;

Output in the Messages view:

  • sa_icon_message.png SA0036: Unused output 'iOut1'