POV-Ray : Newsgroups : povray.off-topic : Curious C / C++ defined behavior question : Re: Curious C / C++ defined behavior question Server Time
30 Jul 2024 00:24:16 EDT (-0400)
  Re: Curious C / C++ defined behavior question  
From: clipka
Date: 29 Jun 2011 23:40:46
Message: <4e0bf03e$1@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.