
20 Jan
2009
20 Jan
'09
9:14 p.m.
AMDG Zachary Turner wrote:
Side note, but the implementation of remove_all does not appear to be tail recursive either, so even the best compiler will not be able to optimize this into a loop, leading to the potential for a stack overflow in deeply nested directory hierarchies. (Now that I think about it, I'm not even sure what, if any, C++ compilers optimize tail recursive calls).
If a function has any local variables with non-trivial destructors, it cannot be tail-recursive. Tail recursion is not worth worrying about in C++. In Christ, Steven Watanabe