Skip to main content

SA0022: (Possibly) unassigned return value

Detects all functions and methods that include an execution thread without an assignment to the return value

Justification: An unassigned return value in a function or method is an indication of missing code. Even if the return value always has a default value, it is always useful to assign it again explicitly to avoid confusion.

Importance: Medium

Example 34. Example
FUNCTION FUN : DINT
VAR_INPUT
    bTest : BOOL;
END_VAR
IF bTest THEN
    RETURN;
END_IF
FUN := 99;

Output in the Messages view:

  • sa_icon_message.png SA0022: (Possibly) unassigned return value