473,327 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Stack overflows

Daz
Hi everyone!

It is indeed, once again time for me to ask another stupid question.

I have been searching around on the net for quite a while, and can't
find anything that explains 'exactly' what a stack overflow is, or how
it's detected. I know that it's leterally putting too many objects on
the stack, but how many objects can you have on the stack, or do OSs
only allow a certain number of recursive calls to functions?

I apologise in advance if I am missing something here.

Regards

Daz

Jun 20 '06 #1
6 2612
Daz wrote:
It is indeed, once again time for me to ask another stupid question.

I have been searching around on the net for quite a while, and can't
find anything that explains 'exactly' what a stack overflow is, or how
it's detected. I know that it's leterally putting too many objects on
the stack, but how many objects can you have on the stack, or do OSs
only allow a certain number of recursive calls to functions?

I apologise in advance if I am missing something here.


You have been posting here long enough to notice all the screams over
off-topic questions, right?

The limit of your stack is implementation-defined, and the behavior when you
overflow it is either implementation-defined or undefined.

You could write a program that calls void foo() { foo(); } and run it to see
what happens. It might be a trappable error, or might be a GPF. All
completely off-topic, because only an on-topic newsgroup can tell you how
reliable the error will be, and how preventable, how recoverable, etc.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Jun 20 '06 #2
Daz

Phlip wrote:
Daz wrote:
You have been posting here long enough to notice all the screams over
off-topic questions, right?

The limit of your stack is implementation-defined, and the behavior when you
overflow it is either implementation-defined or undefined.

You could write a program that calls void foo() { foo(); } and run it to see
what happens. It might be a trappable error, or might be a GPF. All
completely off-topic, because only an on-topic newsgroup can tell you how
reliable the error will be, and how preventable, how recoverable, etc.


Off topic? Good point, I do apologise. I think I should put a bit more
thought into where I am posting as well as what I am posting.

Jun 20 '06 #3
Daz wrote:

Off topic? Good point, I do apologise. I think I should put a bit more
thought into where I am posting as well as what I am posting.

If you are unsure where, mention you platform in your post and someone
will redirect you - but don't make a habit of it :)

--
Ian Collins.
Jun 20 '06 #4
Phlip <ph******@yahoo.com> wrote:
Daz wrote:
It is indeed, once again time for me to ask another stupid question.

I have been searching around on the net for quite a while, and can't
find anything that explains 'exactly' what a stack overflow is, or how
it's detected. I know that it's leterally putting too many objects on
the stack, but how many objects can you have on the stack, or do OSs
only allow a certain number of recursive calls to functions?

You have been posting here long enough to notice all the screams over
off-topic questions, right? The limit of your stack is implementation-defined, and the behavior when you
overflow it is either implementation-defined or undefined. You could write a program that calls void foo() { foo(); } and run it to see
what happens. It might be a trappable error, or might be a GPF.


Somebody correct me if I'm wrong, but I believe the C++ standard
guarantees a recursion depth of 17 -- meaning the in the absence
of stack overflow you can call a function recursively to this
depth, whereas if you exceed the depth it may fail even if
there isn't a stack overflow.

Steve
Jun 21 '06 #5

"Steve Pope" <sp*****@speedymail.org> wrote in message
news:e7**********@blue.rahul.net...

Somebody correct me if I'm wrong, but I believe the C++ standard
guarantees a recursion depth of 17 -- meaning the in the absence
of stack overflow you can call a function recursively to this
depth, whereas if you exceed the depth it may fail even if
there isn't a stack overflow.


I think you're thinking about the suggested minimum value for the maximum
[guaranteed-to-work] depth of recursive template instantiations, not
anything having to do with the stack or recursive function calls.

-Howard


Jun 21 '06 #6
Howard <al*****@hotmail.com> wrote:
"Steve Pope" <sp*****@speedymail.org> wrote in message
Somebody correct me if I'm wrong, but I believe the C++ standard
guarantees a recursion depth of 17 -- meaning the in the absence
of stack overflow you can call a function recursively to this
depth, whereas if you exceed the depth it may fail even if
there isn't a stack overflow.

I think you're thinking about the suggested minimum value for the maximum
[guaranteed-to-work] depth of recursive template instantiations, not
anything having to do with the stack or recursive function calls.


Thanks, that makes more sense.

Steve
Jun 22 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Allen | last post by:
Hi all, What are some different approaches to dealing with stack overflows in C++? I'm especially interested in approaches concerned with speed for infrequent overflows. -- Best wishes,...
13
by: Will Pittenger | last post by:
I have a Control derived class. When the parent of the control changes the control's Location property, the stack overflows. I have not found a way to find out what was on the stack when it does...
19
by: Jim | last post by:
I have spent the past few weeks designing a database for my company. The problem is I have started running into what I believe are stack overflow problems. There are two tab controls on the form...
87
by: CJ | last post by:
Hello: We know that C programs are often vulnerable to buffer overflows which overwrite the stack. But my question is: Why does C insist on storing local variables on the stack in the first...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.