Skip to main content

Compiler Warning C0298

Message: Calculation of stack usage incomplete because of recursive calls, starting at '<recursive method name'.

Possible cause: The stack check cannot be performed successfully for methods with a recursive call because the stack usage cannot be determined.

Error correction: Use the estimated-stack-usage attribute to give the method an estimated value (in bytes) for the stack size requirement.

Example 464. Example of the error:
METHOD PUBLIC m_Recursive : UDINT
    VAR_INPUT
            uiN : UINT;
    END_VAR
    VAR
    END_VAR
    m_Recursive := 1;
    IF      uiN > 1 THEN
            m_Recursive := uiN * THIS^.m_Recursive(uiN := (uiN - 1) );
            RETURN;
    ELSE
            RETURN;
    END_IF;

Message:

C0298: Calculation of stack usage incomplete because of recursive calls, starting at 'm_Recursive'

Error correction:

{attribute 'estimated-stack-usage' := '99'}


For more information, see: estimated-stack-usage