DMD 0.177 release

Walter Bright newshound at digitalmars.com
Tue Dec 12 20:17:46 PST 2006


Pragma wrote:
> That's better, but look at what's really happening here.  Inlining and 
> compiler optimization aside, the 'constructor' here creates a Foo on the 
> stack which is then returned and *copied* to the destination 'f'.

That problem was solved 15 years ago (for C and C++). I admit that due 
to sloth I had failed to implement the solution yet in dmd, but it is 
implemented now and will go out in the next update. There will be NO 
extra copies.

For whatever the merits of opCall vs this(), efficiency is NOT a problem 
with either, and is not a reason to choose one or the other. The 
generated code is the same.

Under the hood, they are the same. Both take a hidden pointer to where 
the result is stored. The rest is window dressing.



More information about the Digitalmars-d-announce mailing list