Thread: is there a ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    113

    is there a ...

    tool that you can trace a recursive function?
    or in other words a tool, program, etc, where graphicaly you can see the workflow of recursion? have somebody a link for this great tool(if exists).
    or give me some tips how can i follow a recursive function steps

    thanks in advance

  2. #2
    Registered User Frobozz's Avatar
    Join Date
    Dec 2002
    Posts
    546
    You could have the program generate a file and output information during every step of the recursive function to said file.

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    113
    ok i know i have a lot of options to trace that, but i just was curious if there exists some kind of tool to see recursion in action,
    thanks for posting

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    A good visual debugger will allow you to unwind and inspect the call stack.

    If you want some kind of visual feed back as your code recurses, you will have to do that your self

    gg

  5. #5
    Registered User Frobozz's Avatar
    Join Date
    Dec 2002
    Posts
    546
    Well you could take CInt which is a C/C++ interpreter and modify it to show you the steps the function is going through. It may even have the ability already built in.

    Edit: 100th post.

  6. #6
    Registered User
    Join Date
    Mar 2004
    Posts
    113
    ok thanks for reply

    i will have to make that kind of tool, and maybe could be helpfull
    for other people learning to program, specialy to show the real power of recursion, and how it works.

    i'm thinking of a tool that you enter some options , functions, etc
    and that show you visualy(grapchics) how it will behave.
    of course that will be when i finish my c++ book.

  7. #7
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903

    Exclamation

    i would like to help you with recurrsion.. but i am still in the process of learning recurssion.
    Last edited by The Brain; 09-02-2004 at 07:27 PM.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  8. #8
    Registered User jlou's Avatar
    Join Date
    Jul 2003
    Posts
    1,090
    I would assume a profiler might be able to help you with this, but I've never used one for that purpose.

  9. #9
    Registered User
    Join Date
    Mar 2004
    Posts
    113
    Quote Originally Posted by The Brain
    i would like to help you with recurrsion.. but i am still in the process of learning recurssion.
    well i understand recursion , know i'm learning data structures(binary trees) and im using recursion a lot, but sometimes i get lost where the execution of the program goes

  10. #10
    Teenage Mutant Ninja Nerd MMD_Lynx's Avatar
    Join Date
    Aug 2004
    Posts
    65
    recursion is simple. it's just when a program calls itself. or you could do something weird like:
    Code:
    int recur(int i)
    {
       cout<<i<<endl;
       return recur(i/2);
    }
    Stupid people are useful. You can make them do all the mindless tasks you are too lazy to do yourself.

    Sphynx cats are just bald and wrinkly, like old people, and we don't reject them.

  11. #11
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    a fractal generator
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  12. #12
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    i think after learning recurrsion.. i might move on to recurrsion.. and then maybe after that study a little on recurrsion
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  13. #13
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    maybe learning how to spell it would get rid of that infinite recursion problem
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  14. #14
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >is there a ... tool that you can trace a recursive function?
    cout.

    >but sometimes i get lost where the execution of the program goes
    Print it as it goes, litter your code with print statements, and draw the structure on paper. Paper is very important when working with complex data structures. Most of the time you simply cannot get everything in your head and paper is a good place to put down what you know as well as what you expect so that you can compare with what is.
    My best code is written with the delete key.

  15. #15
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Quote Originally Posted by Prelude
    Print it as it goes, litter your code with print statements, and draw the structure on paper. Paper is very important when working with complex data structures. Most of the time you simply cannot get everything in your head and paper is a good place to put down what you know as well as what you expect so that you can compare with what is.
    best advice ever... I used to think I could do it all in my head, but after learning inheritance and polymorphism and using them in loops nested to the level of 5 along with recursive functions, you really lose your way... then you change one little think and if fcks with your entire program...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

Popular pages Recent additions subscribe to a feed