473,398 Members | 2,404 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,398 software developers and data experts.

Stack overflow

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
Jul 22 '05 #1
3 2679
<ip****@yahoo.com> wrote in message
news:13************************@posting.google.com ...
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

Jul 22 '05 #2
On 29 Jun 2004 17:23:50 -0700, ip****@yahoo.com 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
Jul 22 '05 #3
posted:
void my_stack_function( function parameters)
{
do required stuff
if(some conditions obeyed)
call my_stack_function(function parameters);
}

What's "call"?

-JKop
Jul 22 '05 #4

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

Similar topics

7
by: Aguilar, James | last post by:
Hello all, To begin, yes, this -is- a homework assignment. However, it is for my Algorithms class, and my instructor has given us explicit permission to use "expert" groups like newsgroups, so...
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...
4
by: Victor | last post by:
Hello, I've got a situation in which the number of (valid) recursive calls I make will cause stack overflow. I can use getrlimit (and setrlimit) to test (and set) my current stack size. ...
2
by: David W. Walker | last post by:
I am attempting to port a C code that runs OK on a number of Linux and Unix machines to Windows XP using Visual Studio C++. I have set the program up as a console application, but when I try to run...
2
by: Ali | last post by:
Hi, I got stack overflow errors while using an unmanaged dll from managed c# application. When i use editbin.exe to increase stack size of app , it works. Is there a way to increase stack size of...
6
by: Daz | last post by:
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'...
24
by: John | last post by:
I know this is a very fundamental question. I am still quite confused if the program call stack stack should always grows upwards from the bottom, or the opposite, or doesn't matter?? That means...
7
by: amit.atray | last post by:
Environement : Sun OS + gnu tools + sun studio (dbx etc) having some Old C-Code (ansi + KR Style) and code inspection shows some big size variable (auto) allocated (on stack) say for ex. char...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.