SA0160: Recursive calls
Detects recursive calls in actions, methods, and properties of function blocks. Also detects possible recursions from virtual function calls and interface calls.
Justification: Recursions lead to non-deterministic behavior and are therefore a source of errors.
Importance: Medium
PLCopen rule: CP13
Example 118. Example
The following method Call is assigned to the function block FB_Test:
FUNCTION_BLOCK FB_Test
VAR
bParameter: BOOL;
END_VAR
METHOD Call : BOOL VAR_INPUT END_VAR
Call := THIS^.Call(); //SA0160
The program PLC_PRG calls FB_Test:
PROGRAM PLC_PRG
VAR
fbTest : FB_Test;
bValue : BOOL;
END_VAR
bValue := fbTest.bParameter; fbTest.Call();
Output in the Messages view:
SA0160: Recursive call detected: 'PLC_PRG' -> 'FB_Test.Call' -> 'FB_Test.Call'