You are here: start » ppl » statements » stackleft

STACKLEFT()

STACKLEFT()

Returns the number of bytes left on the system stack.

Example:

	println "There are ",STACKLEFT()," bytes left on the stack"
	;recursive call support
	function stan(integer i,string str)
		if(stackleft() > STK_LIMIT) stan(i,"Debra")
	endfunc

This function was added to support nested and recursive function calls. Since function calls take a lot of stack space. As of now only about 26 nested or recursive calls can eat up the stack. This lets the programmer know when he/she is running out of stack space as to avoid a runtime error. Both recursion and nested function calls should check this value if more than just a few calls are to be executed.
See also: StackErr StackAbort

ppl/statements/stackleft.txt · Last modified: 2019/04/16 14:00
CC Attribution 4.0 International Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution 4.0 International