Message on thread Stack Usage?

Stack Usage? (2018-07-06 21:53, toml_12953, #81579)

In the various version of Decimal BASIC (Decimal, Acc and Acc2) how many bytes does each call to an iterative function take? Is it dependent on the number of parameters?

I have an Ackermann function and I'm trying to calculate the number of bytes on the stack at each iteration.

FUNCTION ackermann(m,n)
LET stksiz=stksiz+32 ! The 32 is the number to be replaced so I need to know how much each call adds to stack size
LET ncalls = ncalls + 1
LET curstack = stksiz
IF curstack > stacksize THEN
LET stacksize = curstack
END IF
IF m = 0 THEN
LET ackermann=n+1
EXIT FUNCTION
END IF
IF n = 0 THEN
LET ackermann=ackermann(m-1,1)
EXIT FUNCTION
END IF
LET ackermann=ackermann(m-1,ackermann(m,n-1))
END FUNCTION

A number takes 8 bytes, correct? That would mean that this would take 16 bytes plus some for the return address. Is the total number easily calculable?

Reply to #81579×

You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

Thread

Stack Usage? (2018-07-06 21:53, toml_12953, #81579)
Re: Stack Usage? (2018-07-07 14:31, SHIRAISHI Kazuo, #81583)
Re: Stack Usage? (2018-07-07 17:25, SHIRAISHI Kazuo, #81585)
Re: Stack Usage? (2018-07-07 18:47, toml12953, #81588)
Re: Stack Usage? (2018-07-08 09:31, SHIRAISHI Kazuo, #81592)
Re: Stack Usage? (2018-07-14 10:30, Shiraishi Kazuo, #81601)
Re: Stack Usage? (2018-07-07 17:54, SHIRAISHI Kazuo, #81587)