Tail-call optimization in C is relatively recent

A technical discussion regarding the history and implementation of tail-call optimization (TCO) in C compilers. The author notes that while TCO was historically limited in C, modern compilers like GCC and Clang have improved support for it.
Why it matters
Understanding compiler optimizations is critical for systems programming and performance-sensitive software development.
Tail-call optimization in C is relatively recent [LWN.net]
Tail-call optimization in C is relatively recent
Posted Aug 21, 2025 22:11 UTC (Thu) by anton (subscriber, #25547)
Parent article: Python, tail calls, and performance
Actually tail calls in C have not been around forever. The C calling convention has been that the callee does not remove any stuff the caller has put on the stack. The caller could see the declaration int f(); , the actual call could have n>0 arguments, and the actual function could have m n parameters. That would not always work if the callee removed the arguments.
So the caller had to remove the arguments between the call and the following return, turning the call into a non-tail call.
Get smarter about the news
Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.
Create free accountAlready have an account? Sign in