SA0059: Comparison operations always returning TRUE or FALSE
Detects comparisons with literals whose result is always TRUE
or FALSE
, and can already be processed during at the compile.
Justification: An operation that consistently yields TRUE
or FALSE
is an indication of a programming error.
Importance: High
Example 70. Example
PROGRAM PLC_PRG VAR byTemp1 : BYTE; END_VAR
WHILE byTemp1 <= 255 DO byTemp1 := byTemp1 + 1; END_WHILE
Output in the Messages view:
SA0059: Relational operator '<=' always evaluates to 'TRUE'