|
![](/i/fill.gif) |
Am 29.06.2011 18:49, schrieb Darren New:
> If you don't have actual *recursive* functions, you don't need to
> allocate locals or arguments on the stack at all. On a machine with
> limited hardware stack (like a 6502 say), you might very well generate
> code that will allocate bigger items in the heap and clean them up when
> you return, for example.
... which does not prevent you from failure due to hitting the memory limit.
> I've used Pascal compilers (on a Z-80 for example) that stored all local
> variables at fixed addresses. I don't remember how it handled recursion,
> but since I was writing a B-Tree library, I'm pretty sure it recursed OK.
In that case it either can't have placed all local variables at fixed
addresses, or must have placed a hard limit on recursions.
Either way, there /always/ is a limit on recursion depth, and AFAIK
determining at compile-time whether an arbitrary program ever hits that
depth is as hard as solving the halting problem.
Post a reply to this message
|
![](/i/fill.gif) |