m4-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tail recursion


From: Doug McIlroy
Subject: tail recursion
Date: Tue, 04 Jul 2017 10:10:15 -0400
User-agent: Heirloom mailx 12.5 7/5/10

I have been writing a lot of recursive m4 macros lately, and
have been disappointed to see that m4 doesn't recognize tail
calls and drop the dead stack frame when one occurs. A vivid
example is to watch memory usage for this trivial example.
        define(x,`x')
        x()
It needlessly eats about 100KB/sec on my Surface netbook.

I suspect someone who knows the code could implement
tail-call optimization easily. So before I dive in to
try to figure out how to do it myself, I ask is there
a pro out there who might like to do it?

Doug



reply via email to

[Prev in Thread] Current Thread [Next in Thread]