www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Blocker for the container work

reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
I just submitted https://issues.dlang.org/show_bug.cgi?id=15328 which is 
currently blocking my work on containers.

In brief the postblit isn't called upon calling

Range save() { return this; }

which of course is less than helpful.

Reductions of the example would be awesome - I reduced it a fair amount 
compared to the initial code, but I'm sure someone without that context 
could do a much better job.


Thanks,

Andrei
Nov 13 2015
parent reply rsw0x <anonymous anonymous.com> writes:
On Friday, 13 November 2015 at 17:01:34 UTC, Andrei Alexandrescu 
wrote:
 I just submitted https://issues.dlang.org/show_bug.cgi?id=15328 
 which is currently blocking my work on containers.

 In brief the postblit isn't called upon calling

 Range save() { return this; }

 which of course is less than helpful.

 Reductions of the example would be awesome - I reduced it a 
 fair amount compared to the initial code, but I'm sure someone 
 without that context could do a much better job.


 Thanks,

 Andrei
afaik that's RVO, isn't it? D's RVO semantics are pretty much unspecified still(outside of dmd,) I believe(don't quote me) that walter said it's supposed to be part of the spec but I could never find anything. there's a few bugs filed on it https://issues.dlang.org/show_bug.cgi?id=10372 https://issues.dlang.org/show_bug.cgi?id=11287 https://issues.dlang.org/show_bug.cgi?id=10371 probably others
Nov 13 2015
next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Friday, 13 November 2015 at 17:25:44 UTC, rsw0x wrote:
 afaik that's RVO, isn't it?
 D's RVO semantics are pretty much unspecified still(outside of 
 dmd,) I believe(don't quote me) that walter said it's supposed 
 to be part of the spec but I could never find anything.
Well, RVO is used when the value being returned is a local variable. The compiler knows that it can be moved rather than copied, so it's moved. However, the this pointer/reference isn't a local variable. It's a member variable. So, it can't be moved. So, RVO shouldn't kick in when returning this. - Jonathan M Davis
Nov 13 2015
prev sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 11/13/2015 12:25 PM, rsw0x wrote:
 On Friday, 13 November 2015 at 17:01:34 UTC, Andrei Alexandrescu wrote:
 I just submitted https://issues.dlang.org/show_bug.cgi?id=15328 which
 is currently blocking my work on containers.

 In brief the postblit isn't called upon calling

 Range save() { return this; }

 which of course is less than helpful.

 Reductions of the example would be awesome - I reduced it a fair
 amount compared to the initial code, but I'm sure someone without that
 context could do a much better job.


 Thanks,

 Andrei
afaik that's RVO, isn't it?
The repro has a bug itself, I'll get back with one that's actually supposed to pass. -- Andrei
Nov 13 2015