3 ms·
In addition to what others have said here; often recursive calls can also trivially be optimized into loops by the compiler. This is very convenient in most ca
by albinofrenchy 11y ago
In addition to what others have said here; often recursive calls can also trivially be optimized into loops by the compiler.
This is very convenient in most cases, but could hide the fact that a direct recursive call will overflow your stack.
This isn't apparent and would test out ok until someone makes a small; seemingly insignificant change which the compiler can't do tail call optimization on, and all of a sudden things fail.