Hacker News new | ask | show | jobs
by ndriscoll 466 days ago
Reasonable compilers translate tail-recursive functions into loops/jumps, so the stack does not grow. Tail recursion is easier to do in a garbage collected functional language though (e.g. if you need to use continuation passing).

Even in C, the recursive solution is usually simpler, so it makes sense to use it for unit tests to validate the more manual solution.