SA0009: Unused return values
Detects function, method and property calls in which the return value is not used
Justification: When a function or method returns a return value, you should also evaluate it. The return value often indicates whether or not the function has been executed successfully. If there is no evaluation, then you will not be able to identify later whether the return value was forgotten or if it is actually not needed.
Exception: If a return value is irrelevant for the call, then you should document this and omit the assignment. Error returns should never be ignored.
Importance: Medium
PLCopen rule: CP7 / CP17
FUNCTION Return_BOOL : BOOL VAR_INPUT END_VAR VAR xTest : BOOL; END_VAR
xTest := FALSE; Return_BOOL := xTest;
PROGRAM PLC_PRG Return_BOOL(); // SA0009
Output in the Messages view:
SA0009: Ignoring return value of 'Return_BOOL'