Does Xcode for the iPhone eliminate tail-call recursion?
-
10-07-2019 - |
Question
Does Xcode support tail-call optimization on the iPhone?
Solution
xcode just uses gcc -- assuming the same thing for the phone, the question is whether gcc performs tail call elimination. I don't believe it does in anything beyond the most basic of cases.
OTHER TIPS
Gcc probably does if you crank up the optimization level.
The newer LLVM may not quite yet:
http://llvm.org/docs/CodeGenerator.html#tailcallopt
That says x86/PPC only... it may be old though as Apple has been doing a lot of work to switch over to LLVM as the new compiler of choice (gcc is still the default though).
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow