Skip to main content

SA0033: Unused variables

Detects variables which are declared but not used within the compiled program code

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: CP22 / CP24

Tip

For GVL variables: If multiple applications exist in a project, then only the objects below the currently active application are considered. If there is only one application, then the objects in the common POU pool are also considered.

Example 43. Example
PROGRAM PLC_PRG
VAR
    iCounter1 : INT;
    iCounter2 : INT;    // SA0033
END_VAR
iCounter1 := 100;

Output in the Messages view:

  • sa_icon_message.png SA0033: Unused variable 'iCounter2'



For more information, see: