Skip to main content

SA0035: Unused input variables

Detects the input variables which are not used by any function block instance

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

An input is considered to be used only if it is actively referenced within the implementation (or the methods) of the function block instance itself.

Importance: Medium

PLCopen rule: CP24

Example 44. Example
FUNCTION_BLOCK FB_Afb
VAR_INPUT
    iIn1: INT;
    iIn2: INT;
END_VAR
VAR_OUTPUT
    iOut1: INT;
END_VAR
iOut1 := iIn1; // iIn1 is used here
PROGRAM PLC_PRG
VAR
    fbAfb: FB_Afb;
END_VAR
fbAfb(iIn2 := 99); // iIn2 is unused internally => error

Output in the Messages view:

  • sa_icon_message.png SA0035: Unused input 'iIn2'