Stack overflow

I

ip4ram

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
 
L

Leor Zolman

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
 
J

JKop

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


What's "call"?

-JKop
 
D

David White

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Stack overflow 5
Callback Function Stack Overflow 3
CComBSTR, std::endl and stack overflow 0
Stack 9
Stack Data Structure 6
stack overflow 6
While Loop Freezing? 1
How to avoid stack overflow in C???? 7

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top