Skip to main content

SA0062: Expression is constant

Detects the usage of expressions which always have the same value at runtime.

Justification: A complex expression which is calculated repeatedly and always generates the same value may indicate an error. This applies in particular if something else was intended. In each case, the expression unnecessarily burdens the runtime of the program.

Importance: Medium

Example 73. Example
PROGRAM PLC_PRG
VAR
    value : INT;
    condition : BOOL;
END_VAR
value := 8;
condition := value = 8 // Reports: Expression (value=8) is always TRUE

Output in the Messages view:

sa_icon_message.png SA0062: Expression '(value=8)' is always TRUE