logoalt Hacker News

StilesCrisistoday at 2:58 PM2 repliesview on HN

Clang tail-calls aren't guaranteed to work with all C++ code. If you have a non-trivial constructor, as you mention, it will tell you this and fail instead of silently letting you believe you have tail-calls when you don't.


Replies

fweimertoday at 5:41 PM

There are far more cases. Some ABIs use callee-saved registers for parameter-passing under certain circumstances, for example. Usually, there are compatibility restrictions on the signatures of the current and tail-called functions beyond the return type, too.

This is different from Scheme or the MLs (there as a quality-of-implementation feature) where tail calls into arbitrary functions are expected not to lead to space leaks.

tialaramextoday at 6:37 PM

I have to say that at least knowing if I didn't get what I wanted is most of the value for me.