3 ms·
> Too bad those are not implemented in supposedly high-performance popular languages. Perhaps a nitpick: you presumably mean tail-call optimisation, which isn'
by MaxBarraclough 5y ago
> Too bad those are not implemented in supposedly high-performance popular languages.
Perhaps a nitpick: you presumably mean tail-call optimisation, which isn't the same thing as a tail-call.
To my knowledge modern C compilers are generally able to perform the optimisation.
I believe Java has a hard time with tail-call optimisation as its exception-handling features require it to faithfully track the call stack in case an exception is thrown.
- spc476 5y agoYes, GCC can do tail-call optimization. What you can't do is rely up on in C. Lua has tail-call optimizations and because of that, you can rely upon it. There is a difference.
- MaxBarraclough 5y agoRight, some languages guarantee tail-call optimisation in the language spec itself. The C standard doesn't do this.
- srean 5y ago> Perhaps a nitpick: you presumably mean tail-call optimisation, which isn't the same thing as a tail-call. Tail calls consuming unnecessary stack space is a common pessimisation.