Stack overflow

Discussion in 'C++' started by ip4ram@yahoo.com, Jun 30, 2004.

  1. Guest

    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
     
    , Jun 30, 2004
    #1
    1. Advertising

  2. Leor Zolman Guest

    On 29 Jun 2004 17:23:50 -0700, 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
     
    Leor Zolman, Jun 30, 2004
    #2
    1. Advertising

  3. JKop Guest

    posted:

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



    What's "call"?

    -JKop
     
    JKop, Jun 30, 2004
    #3
  4. David White Guest

    <> wrote in message
    news:...
    > 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
     
    David White, Jun 30, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?amJpeEBuZXdzZ3JvdXBzLm5vc3BhbQ==?=

    Stack overflow exception

    =?Utf-8?B?amJpeEBuZXdzZ3JvdXBzLm5vc3BhbQ==?=, Apr 20, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    7,282
    Rick Spiewak
    Apr 22, 2004
  2. Mr m?ll
    Replies:
    2
    Views:
    1,418
    Mr m?ll
    Oct 16, 2004
  3. Replies:
    0
    Views:
    509
  4. Replies:
    0
    Views:
    412
  5. Kenneth McDonald

    Why stack overflow with such a small stack?

    Kenneth McDonald, Aug 30, 2007, in forum: Ruby
    Replies:
    7
    Views:
    277
    Kenneth McDonald
    Sep 1, 2007
Loading...

Share This Page