Attribute estimated-stack-usage

Overview

The pragma {attribute 'estimated-stack-usage' := '<estimated stack size in bytes>'} helps to prevent runtime systems with an active stack check from issuing a message (C0298: Calculation of stack usage incomplete because of recursive calls) indicating that there is insufficient space in the stack. This check is performed during the code generation. For recursive methods, you may want to reduce the number of messages.

Syntax

{attribute 'estimated-stack-usage' := '<estimated stack size in bytes>'}

Insert Location

Insert this pragma in the line above the METHOD declaration in the declaration section of the relevant method.

Example

{attribute 'estimated-stack-usage' := '99'}
METHOD PUBLIC m_Temp : UDINT
VAR_INPUT
    uiN : UINT;
END_VAR

m_Temp := 1;
IF uiN > 1 THEN
    m_Temp := uiN * THIS^.m_Temp(uiN := (uiN- 1));
    RETURN;
ELSE
    RETURN;
END_IF