TIP: Click on subject to list as thread! ANSI
echo: z3_pascal
to: Bob Lawrence
from: Ian Smith
date: 1996-07-29 06:32:40
subject: Memory above 64K

BL> Your demo is doing that intentionally, but you can do it
 BL> accidentally too. If you call part of a program within itself
 BL> recursively again and again, and use a new variable each time
 BL> (a large array, say) then you need stack space for that
[..]
 IS> lot of parameters can certainly eat up stack space pretty
 IS> quickly. However, arrays (and other structures longer than 4
 IS> bytes, with the exception of reals) aren't passed on the stack
 IS> at all; even if not declared as VAR parameters, these are
 IS> passed as a pointer to the structure. Turbo then makes a local
 IS> copy for the current procedure's use

 BL>   It was a shorthand explanation; not a definitive text. It seemed to
 BL> me that the main problem was the thought that a larger stack made a
 BL> program run better, and it that idea I tried to correct.

Fair enough.

 BL>   And a large array *is* on the stack, along with 256-byte strings and
 BL> the rest. Your words are just as inaccurate as mine.

You're right; I got to thinking after I wrote that - obviously 'local
storage' for each invocation of a recursive procedure or function HAS to be
done on the stack, unless using Var parameters, or as you mentioned, heap
variables.

Ian (desperately seeking help from Pedants Anonymous :)

--- MaltEd 1.0.b5
* Origin: Magic Puddin' BBS Nimbin 066-89-1843 V.32bis/V.42 (3:626/660)
SEEN-BY: 633/267 270
@PATH: 626/660 711/401 808 50/99 635/544 727 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.