Jump to content

Guide to recursion


Dozer

Recommended Posts

  • 4 weeks later...

It really is an area of programming where the programmer must tread carefully.

Indeed, the biggest danger being a stack overflow. This is not something PC developers are aware of as the default stack is rather big. But stack overflow may very well bite you if you have to port your perfectly working and elegant program on some other platforms.

 

If you need to port on such platforms and chose to stick with recursion you will then have to make sure any input data that your program will have to deal with will never ever overflow the stack no matter where the stack pointer is a the time your recursive program is called. This means things like checking all code paths, size of arguments passed on stack and all local variables in each of these code paths.

 

Having to develop on several platforms, recursion is something I stay away from, too much potential trouble.

 

PhM

  • Upvote 1
Link to comment
Share on other sites

  • 4 weeks later...

Did you read the linked article PhM ;)

Yes. And as this is about plugin development, in other words programming, I thought that someone might end up here while looking for what recursion is all about. Given the fact that your comment : "It really is an area of programming where the programmer must tread carefully." was totally appropriate I decided to add some facts to help understand why it is not a good thing to do. In short : Nice and fun in academic discussions, too risky in real life.

 

PhM

  • Upvote 1
Link to comment
Share on other sites

Nice and fun in academic discussions, too risky in real life.

Actually you misquoted me: I said it's an iaiarea where programmers must tread carefully. More serious than writing bad code, they risk awakening the Old Ones... wait... did you hear that? They're coming! They're here! Ia! Ia! Cthulhu fhtagn!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...