I came across a page that talks about Joint Strike Fighter(JSF) coding standards .I was surprised to find out that these standards explicitly forbid usage of recursion.A Google search on why led to another interesting link which outlines NASA’s rules of software development which also doesn’t allow recursion to be used.
Why? Recursion conceptually is a very handy tool to use, makes code readable or elegant, at the very least.However, I think, recursion can be problem if isn’t bound properly. Aka with each recursive call it should get closer to the bound & if it doesn’t could possibly lead to overflow and program crashing. Which is a risk that critical software systems can’t take.
It is my understanding that it is may not be possible to test recursive code will terminate gracefully by not getting into an infinite loop.
While thinking about this, realized that anything that can be done using recursion can be done iteratively with is much more simpler and can be tested in a deterministic way every time to ensure that it will end gracefully.