1

Does Xcode support tail-call optimization on the iPhone?

Bill
  • 44,502
  • 24
  • 122
  • 213

2 Answers2

2

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).

Kendall Helmstetter Gelner
  • 74,769
  • 26
  • 128
  • 150
1

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.

olliej
  • 35,755
  • 9
  • 58
  • 55