2 ms·
though C compilers usually do not implement 'proper' tail calls With optimizations turned on, gcc turns a tail recursive function into the equivalent of a for
by seiji 16y ago
though C compilers usually do not implement 'proper' tail calls
With optimizations turned on, gcc turns a tail recursive function into the equivalent of a for loop.
- danvet 16y ago.. which I've lately found out the hard way: Code of mine randomly crashed and valgrind told me it's due to use of unintiliazed memory. An awful lot of time later (i.e. one valgrind --track-origins=yes run) I know that it's from function foo's stack space. Which contains one local variable which is clearly assigned at the beginning. _Much_ later I find out that the problem is in bar, tail-called by foo. At least now I know that latest gcc can do tail-call optimizations.