SA0033: Unused variablesPermalink

Detects variables that 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

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

Example

PROGRAM PLC_PRG
VAR
	iCounter1 : INT;
	iCounter2 : INT;		// SA0035
END_VAR

ICounter1 := 100;

--> SA0035: Unused Variable 'iCounter2'