scitools.com

← Metric catalog

Maximum Call Depth is one of the source-code metrics Understand computes across 17+ languages — browse them in the GUI, export and track them, or script them with the Python API.

Maximum Call Depth

API IDMaxCallDepth
TargetsFunctions
LanguagesAny
SolutionHersteller Initiative Software (HIS)
CategoriesHierarchy
CostQuery

The maximum depth of the call tree or -1 for recursive

Also known as Hersteller Initiative Software (HIS) LEVEL metric.

Example:

    void depth0() {}            // MaxCallDepth = 0
    void depth1() { depth0(); } // MaxCallDepth = 1
    void depth2() { depth1(); } // MaxCallDepth = 2

    void depth2b()              // MaxCallDepth = 2
    {
      depth0();
      depth1();
    }

    void recursive()            // MaxCallDepth = -1 recursion
    {
      recursive();
    }

    void a();
    void b() { a(); }           // MaxCallDepth = -1 recursion
    void c() { b(); }           // MaxCallDepth = -1 recursion
    void a() { c(); }           // MaxCallDepth = -1 recursion

    void callsCycle() { a(); }  // MaxCallDepth = -1 recursion