C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Stack overflow

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
ip4ram@yahoo.com
Guest





PostPosted: Wed Jun 30, 2004 12:23 am    Post subject: Stack overflow Reply with quote



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
Back to top
Leor Zolman
Guest





PostPosted: Wed Jun 30, 2004 1:03 am    Post subject: Re: Stack overflow Reply with quote



On 29 Jun 2004 17:23:50 -0700, [email]ip4ram (AT) yahoo (DOT) com[/email] wrote:

Quote:
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

Back to top
JKop
Guest





PostPosted: Wed Jun 30, 2004 10:53 am    Post subject: Re: Stack overflow Reply with quote



posted:

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


What's "call"?

-JKop

Back to top
David White
Guest





PostPosted: Wed Jun 30, 2004 2:01 pm    Post subject: Re: Stack overflow Reply with quote

<ip4ram (AT) yahoo (DOT) com> wrote

Quote:
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




Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.