SA0009: Unused return values

Function

Determines function, method and property calls for which the return value is not used.

Reason

If a function or method returns a return value, the value should be evaluated. In many cases the return value contains information to indicate whether the function was executed successfully. If no evaluation is performed, it is subsequently not possible to determine whether the return value was overlooked or whether it is in fact not required.

Exception

If a return value is of no interest during a call, this should be documented and the assignment can be omitted. Error returns should never be ignored!

Importance

Medium

PLCopen rule

CP7/CP17

Sample:

Function F_ReturnBOOL:

FUNCTION F_ReturnBOOL : BOOL
F_ReturnBOOL := TRUE;

MAIN program:

PROGRAM MAIN
VAR
    bVar  : BOOL;
END_VAR
F_ReturnBOOL();                  // => SA0009 
bVar := F_ReturnBOOL();