especially when trying to transition users from an old interface to a new one, but it's just an easy mistake away from instead writing:
void foo(double x) { foo(x); }
which will still compile, but will fail at runtime.
I'd expect any function that just immediately and unconditionally calls itself (possibly within a return expression) is probably erroneous and meant to call something else.
Original issue created by mdempsky@google.com on 2013-11-04 at 09:08 PM
It's not uncommon to have chained methods like:
void foo(int x) { ... } void foo(double x) { foo((int) x); }
especially when trying to transition users from an old interface to a new one, but it's just an easy mistake away from instead writing:
void foo(double x) { foo(x); }
which will still compile, but will fail at runtime.
I'd expect any function that just immediately and unconditionally calls itself (possibly within a return expression) is probably erroneous and meant to call something else.