August 10, 2026

Stack drama has entered the chat

Tail-call optimization in C is relatively recent

Turns out this “old” coding trick wasn’t standard for ages — and commenters are stunned

TLDR: The article says a useful memory-saving trick in C only became practical in mainstream compilers relatively late, with major improvements arriving around the 2000s. Commenters were split between shock, age jokes, and war stories from JavaScript and Windows crashes — proof this obscure topic hits a real nerve.

A tiny programming history lesson turned into a full-on "wait, WHAT?" moment for the community. The big reveal: a speed-up trick called tail-call optimization — basically, a way for programs to repeat themselves without piling up more and more memory use — wasn’t really a given in C for most of its life. The article walks through why older C compilers often couldn’t do it cleanly, and says things only started changing in a serious way in the early 2000s. Today, newer versions of GCC and Clang can handle the kind of usage the author tested, opening the door to much bigger code-generation experiments. And yes, there’s a cheeky victory lap for Python getting there first.

But the real fireworks were in the comments. One camp was genuinely surprised, with people admitting they’d just learned C was so late to this trick at all. Another camp instantly went into "hold on, 2001 is ‘recent’ now?" mode, joking that calling a quarter-century-old change “recent” is either hilarious or deeply cursed. Then came the battle scars: one commenter dragged in JavaScript, reminding everyone that tail-call support was added and then removed, which led to delightful chaos and stack-overflow bugs. Another piled on with a Windows memory lane story about a recursive C++ program crashing because Microsoft’s compiler lagged behind. And in peak internet fashion, someone even turned the article structure itself into drama, grumbling that modern writing is designed to harvest attention before delivering the key point. So yes, the coding news mattered — but the comments were the real performance boost.

Key Points

  • The article says traditional C calling conventions prevented many calls from being optimized as true tail calls because the caller had to remove stack arguments after the call.
  • The author reports that C compilers examined in 1994 did not perform the relevant tail-call optimization.
  • The article identifies Mark Probst’s 2001 GCC implementation, using a separate calling convention, as an important step in GCC tail-call optimization.
  • The author says modern GCC and Clang now successfully optimize the tail-call patterns needed for the discussed use case, including interpreter-related patterns tested by the author.
  • The article argues that this support could let Gforth use far more code snippets—potentially enabling techniques impractical in a `goto *`-based system—though Gforth has not adopted it yet.

Hottest takes

"Relatively recent being a quarter of century?" — messe
"TCO was added then removed from js!" — mmsc
"The reader's time is a resource to be extracted" — nyeah
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.