Machine-translated by Google. Questions are authored in English.
Top

Discussion

Tail call optimisation replaces a call in tail position by

  • A.a loop that repeats the caller's own body
  • B.a table lookup of the callee's return value
  • C.a jump, reusing the current activation record
  • D.an inlined copy of the callee's whole body

Answer: C

Because nothing remains to be done after the call, the frame can be reused. This turns tail recursion into iteration and removes the risk of stack exhaustion. Some languages require the optimisation rather than merely permitting it.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.