News for hackers. Stuff that matters.
Re:Seemingly impossible functional programs (2007) by fakedrake on Tuesday November 17, 2015 @04:48AM (#10580078)
I wonder what the state of tail call optimization is in mainstream c++ compilers these days.
Re:Seemingly impossible functional programs (2007) by lhecker on Tuesday November 17, 2015 @05:45AM (#10580268)
AFAIK most compiler will do tail-recursion optimization if the method ends in a tail call to the current function (obviously) or to a "sibling" function (i.e. if a() calls b() which calls a() again and so on) and is sufficiently short to be suitable for inlining.

It's important to remember local objects with destructors will make this impossible, since destructors are run at the end of the function scope and thus after what's seemingly a perfect tail call.

Re:Seemingly impossible functional programs (2007) by fakedrake on Tuesday November 17, 2015 @09:29AM (#10581218)
I almost regretted asking since google answered my question in seconds, but the destructor thing would never have occured to me.
Re:Seemingly impossible functional programs (2007) by hellofunk on Tuesday November 17, 2015 @06:01AM (#10580316)
+1 about the point on destructors. Easy to overlook.