SA0051: Comparison operations on BOOL variablesPermalink

Detects comparison operations on variables of type ‎BOOL‎

Justification: CODESYS permits these kinds of comparison, but they are very unusual and can be confusing. The IEC 61131-3 standard does not provide for these comparisons. By avoiding them, you increase the portability of the code to other development systems.

Importance: Medium

Example

PROGRAM PLC_PRG
VAR
	xBool1, xBool2 : BOOL;
	xResult : BOOL;
END_VAR
xResult := xBool1 > xBool2;  // SA0051
xBool1 := NOT xBool1;	       // OK!
xBool2 := xBool2 XOR xBool1;	// OK!

--> SA0051: Comparison operations on BOOL varables