Tail-Call Optimization in C: A Recent Arrival

Tail-call optimization in C is relatively recent

A LWN reader reflects on the history of tail-call optimization in C, noting that it wasn't always available. In 1994, compilers didn't optimize tail calls due to calling convention constraints. Mark Probst's 2001 GCC implementation had limitations, like no indirect calls. Recent tests show GCC and Clang now handle tail calls well, enabling techniques like the 100,000 code snippets used in Copy-and-Patch Compilation, a leap from Gforth's 2,000. The author congratulates Python for adopting it first.

Actually tail calls in C have not been around forever.

More from this day

2026-08-10