Compiler Error C0186
Message: It is not possible to compare interface that is return value of call. Assign to variable first.
Possible error cause: A comparison operation is applied to an interface that is returned by a function.
Error correction: First assign the result of the function call to a variable and then compare the value of the variable. This will also reduce the number of function calls that are required.
Example of the error:
INTERFACE MyInterface
FUNCTION GetInterface : MyInterface
PROGRAM MAIN
IF GetInterface() <> 0 THEN
// ...
END_IFMessage:
C0186: It is not possible to compare interface that is return value of call. Assign to variable first.
Error correction:
PROGRAM MAIN
VAR_TEMP
tempInterface : MyInterface;
END_VAR
tempInterface := GetInterface();
IF tempInterface <> 0 THEN
// ...
END_IF