On Fri, 23 May 2003 11:33:01, Keith Rollin allegedly wrote:On the Palm, where the stack is a precious resource, converting to an iterative form is probably the best idea.
Precious, as is all memory, but not too limited. The default stack on a Pilot 5000 is 8 times larger than the maximum stack on an Apple II.
10 times, I think. 256 bytes [1] on the Apple ][, 2.5K [2] on the Pilot 5000.
Perfectly suitable for many recursive algorithms, given some means to manage the nesting limit. And all current PalmOS models allow allocation of an even larger stack, unless one suggests that there is some need to still support PalmOS 1.0 thru 2.x.
However, keep in mind that not too many (if any) people programmed in C on the Apple ][. They either used BASIC (Integer or Applesoft) which didn't have activation frames that needed to be saved (just a return address -- which probably was saved somewhere else besides the hardware stack anyway) or assembly (which also saved only a return address -- and not too many people bothered to save A, X, or Y either). And I don't expect that the Apple Pascal runtime used the hardware stack, since it was a full VM.
My point being that the use of C (or any other native high level language) puts a larger stress on the stack, and that using non-stack intensive algorithms -- where possible -- is probably a good idea.
-- Keith
[1] I'm trying like crazy to dig some memory that's niggling at me. Didn't something use the lower end of page 1? That would eat up some of that 256 bytes.
[2] Less 80 or so bytes for the UIAppShell which launched the applications.
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
