Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Stack overflow

Reply
Thread Tools

Stack overflow

 
 
ip4ram@yahoo.com
Guest
Posts: n/a
 
      06-30-2004
I am quite puzzled by the stack overflow which I am encountering.Here
is the pseudocode

//define stack structure

//function operating on stack
void my_stack_function( function parameters)
{
do required stuff
if(some conditions obeyed)
call my_stack_function(function parameters);
}

//in main()
{
initial conditions;
if(conditions obeyed)
{
call my_stack_function(function parameners);
call a_function_to_pop_contents_of_stack();


}
}
The conditions are so set that my_stack_function is not called
infinite number of times. I get a stack overflow when executing this.I
am not sure if I made any logical error.Does anybody see any silly
logic??

Thanks for your help
Ram
 
Reply With Quote
 
 
 
 
Leor Zolman
Guest
Posts: n/a
 
      06-30-2004
On 29 Jun 2004 17:23:50 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

>I am quite puzzled by the stack overflow which I am encountering.Here
>is the pseudocode
>
>//define stack structure
>
>//function operating on stack
>void my_stack_function( function parameters)
>{
> do required stuff
> if(some conditions obeyed)
> call my_stack_function(function parameters);
>}
>
>//in main()
>{
> initial conditions;
> if(conditions obeyed)
> {
> call my_stack_function(function parameners);
> call a_function_to_pop_contents_of_stack();
>
>
> }
>}
>The conditions are so set that my_stack_function is not called
>infinite number of times. I get a stack overflow when executing this.I
>am not sure if I made any logical error.Does anybody see any silly
>logic??
>
>Thanks for your help
>Ram


Any time you have a stack overflow, suspect runaway recursion. It may not
be infinite recursion (because it does eventually crash with an error
message!) but it is probably effectively infinite. Post your actual code if
you can't figure it out...
-leor


--
Leor Zolman --- BD Software --- www.bdsoft.com
On-Site Training in C/C++, Java, Perl and Unix
C++ users: download BD Software's free STL Error Message Decryptor at:
www.bdsoft.com/tools/stlfilt.html
 
Reply With Quote
 
 
 
 
JKop
Guest
Posts: n/a
 
      06-30-2004
posted:

> void my_stack_function( function parameters)
> {
> do required stuff
> if(some conditions obeyed)
> call my_stack_function(function parameters);
> }



What's "call"?

-JKop
 
Reply With Quote
 
David White
Guest
Posts: n/a
 
      06-30-2004
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ...
> I am quite puzzled by the stack overflow which I am encountering.Here
> is the pseudocode
>
> //define stack structure
>
> //function operating on stack
> void my_stack_function( function parameters)
> {
> do required stuff
> if(some conditions obeyed)
> call my_stack_function(function parameters);
> }
>
> //in main()
> {
> initial conditions;
> if(conditions obeyed)
> {
> call my_stack_function(function parameners);
> call a_function_to_pop_contents_of_stack();
>
>
> }
> }
> The conditions are so set that my_stack_function is not called
> infinite number of times. I get a stack overflow when executing this.I
> am not sure if I made any logical error.Does anybody see any silly
> logic??


No. Real code is needed, not only to see the problem, but to qualify as
on-topic here.

DW



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C/C++ compilers have one stack for local variables and return addresses and then another stack for array allocations on the stack. Casey Hawthorne C Programming 3 11-01-2009 08:23 PM
Why stack overflow with such a small stack? Kenneth McDonald Ruby 7 09-01-2007 04:21 AM
SDM Java stack overflow Art Cisco 1 02-18-2006 07:34 PM
smart navigation gives stack overflow Mr m?ll ASP .Net 2 10-16-2004 01:09 PM
Stack overflow exception =?Utf-8?B?amJpeEBuZXdzZ3JvdXBzLm5vc3BhbQ==?= ASP .Net 5 04-22-2004 04:48 AM



Advertisments