News
It's also worth noting that support for tail recursion makes tail recursive and iterative loops equivalent, that is, recursion doesn't always have to waste the stack.
Recursion is (in many, but not all) languages slightly slower, and it does have some dangers (smashing the stack), but used properly it's a completely legitimate, valuable tool for production code.
When the recursive Java factorial program runs, it creates a stack of method calls that look like this: factorialFunction(5) factorialFunction(4) factorialFunction(3) factorialFunction(2) ...
Note that there are situations other than unbounded recursion in which a stack overflow might occur, but this blog posting is limited to StackOverflowError caused by unbounded recursion.
Some results have been hidden because they may be inaccessible to you
Show inaccessible results