SA0022: (Possibly) unassigned return value

Function

Determines all functions and methods containing an execution thread without assignment to the return value.

Reason

An unassigned return value in a function or method indicates missing code. Even if the return value always has a default value, it is useful to explicitly assign it again in any case, in order to avoid ambiguities.

Importance

Medium

Sample:

FUNCTION F_Sample : DWORD
VAR_INPUT
    nIn    : UINT;
END_VAR
VAR
    nTemp  : INT;
END_VAR
nIn := nIn + UINT#1;
 
IF (nIn > UINT#10) THEN
    nTemp    := 1;               // => SA0022
ELSE
    F_Sample := DWORD#100;
END_IF