POV-Ray : Newsgroups : povray.off-topic : Curious C / C++ defined behavior question : Re: Curious C / C++ defined behavior question Server Time
29 Jul 2024 18:18:52 EDT (-0400)
  Re: Curious C / C++ defined behavior question  
From: Warp
Date: 22 Jun 2011 16:07:39
Message: <4e024b8a@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> Does the standard say anything about how deeply nested calls can recurse?  I 
> would imagine this is one of those things that's really difficult to 
> standardize. Or is this one of those "implementation defined" things, which 
> would also seem very difficult to control via the compiler on a modern OS.

  That's an interesting question. I don't have the standard here (after all,
it's commercial, so you either have to pay for it, get a free pre-standard
draft, or pirate it), but if I had to guess, it's most probably implementation
defined (the standard *might* recommend a lower limit, but I don't know if
it does).

  In practice you can run out of stack space if you allocate too much on
the stack, and especially if you then recurse deeply. I don't remember now
what kind of error you get in that case (but the end result is probably an
abort()). In many systems the size of the stack can actually be defined from
the outside (iow. the you tell the OS how much stack space it should reserve
for the program you are going to run).

-- 
                                                          - Warp


Post a reply to this message

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