CallStackDepth (System function): Difference between revisions
Jump to navigation
Jump to search
(Created page with "<span style="font-size:120%; color:black"><b><section begin=dpl_desc/>Get Call Stack Depth<section end=dpl_desc/></b></span> CallStackDepth function [...") |
m (1 revision) |
(No difference)
|
Revision as of 20:20, 1 January 2011
<section begin=dpl_desc/>Get Call Stack Depth<section end=dpl_desc/>
CallStackDepth is a member of the System class.
This shared function returns a number indicating the depth of the call stack.
The CallStackDepth method is available in Sirius Mods 7.2 and later.
Syntax
%depth = %(system):CallStackDepth
Syntax Terms
- %depth
- A numeric variable to receive the current call stack depth (number of nested calls).
- %(system)
- The class name in parentheses denotes a shared method.
Usage Notes
- At level-0 (immediately inside a Begin/End), CallStackDepth always returns 0. For a method or subroutine called directly from level-0 code, CallStackDepth returns 1. For a method called from a method called from level-0, CallStackDepth returns 2; and so on.
- The actual caller associated with a caller can be determined using the CallStackCaller function. The CallStack function can be used to return the same information as returned by CallStackCaller, but for every call level in the call stack. The number of items returned by the CallStack method will always equal the value returned by CallStackDepth at the same point in the code.
- The CallStackDepth method is intended to be used for problem diagnosis and, perhaps, for logging and auditing. Using it to affect method or subroutine behavior by causing a method or subroutine to behave differently depending on the call stack depth is extremely poor technique, and it cannot be discouraged strongly enough.