On Sunday, 28 June 2015 at 13:08:48 UTC, rsw0x wrote:
On Sunday, 28 June 2015 at 11:06:01 UTC, Marc Schütz wrote:
On Sunday, 28 June 2015 at 07:36:41 UTC, Jonathan M Davis wrote:
It makes no sense to pass rvalues by ref. The ref has to refer to a memory location so that a pointer can be passed underneath the hood, and rvalues don't qualify for that.

I strongly disagree with that. This is an implementation detail. `ref` describes a specific semantic, namely that no copying (observable by a postblit being called) takes place,

no, it means pass by reference.
this sounds like some convoluted C++ doublespeak definition.

Well, try experimenting with LDC with -O3 -output-s on some test programs. You will be surprised ;-) There will often be no "reference" in the resulting output, especially with inlining.

The definition I used is not necessarily the best one, but it needs to be based on observable behaviour, not implementation specifics, otherwise compilers would have no freedom in optimizing.

Reply via email to