"jimjim" <netuser@blueyonder.co.uk> wrote in message
news:94Nne.44310$G8.1451@text.news.blueyonder.co.u k[color=blue][color=green]
>>[/color]
> Why shouldnt I place large things on the stack? Do you imply that I
> should create them in the heap for some reason (e.g. heap_memory >>
> stack_memory) ?[/color]
By way of example, the default stack memory on a program compiled with VC++
is 1 Mb (this can be increased with a compiler switch, but the default is an
indication of a "normal" size). The available heap memory on a Windows box
can be up to 2 Gb (assuming your hardware supports this). Thus with a
typical program running on a typical desktop, the available heap memory is
very many times larger than the available stack memory. Personally, I rarely
allocate more than a few Kb within a function's scope. Recursive functions
are the only ones where I might come close to the stack limit.
Basically, if you insist on pushing up close to what is a small limit, you
will waste a lot of your time making sure you don't go over that limit. Only
allocate small amounts on the stack within a function and restrict your
worrying to recursive functions.
[color=blue]
> Where does this "stack overflow" appears?[/color]
That is operating system specific. Under Windows, you can use "Structured
Exception Handling" (which is different from C++ exception handling) to
catch it.
[color=blue]
>
> TIA
>
> P.S: I am used to reading posts on the usenet as follows, which makes
> quite a lot of sense to me. Which news client are you using? Is what
> you are asking documented in the C++_faq?[/color]
One way to find this out would be to look (there is a search facility if the
table of contents seems daunting). As it happens, the answer is yes.
http://www.parashift.com/c++-faq-lit...t.html#faq-5.4
--
John Carson