DMD 0.177 release

Lionello Lunesu lio at lunesu.remove.com
Fri Dec 15 00:21:14 PST 2006


Andrei Alexandrescu (See Website for Email) wrote:
> Lionello Lunesu wrote:
>> Walter Bright wrote:
>>> It is possible to force the return type of opAssign. But I'd suggest 
>>> making it an S*, with the rewrite to:
>>>
>>>     *(a.opAssign(b))
>>>
>>
>> class C {
>>   C* opAssign(...) {...}
>> }
>> struct S {
>>   S* opAssign(...) {...}
>> }
>>
>> Seriously?? Ugh.
>>
>> Why not just "C opAssign" and "S opAssign"? In the opCall discussion 
>> you said yourself that the return value will be optimized.
>>
>> Am I missing something?
> 
> There is no *extra* copying, in the sense that exactly one copy is done. 
> But most of the time the copy obtained is not used, in which case that 
> one copy is spurious.

I'd think that the optimizer would not only eliminate the extra copy, 
but the entire construction of the return value .. No?

L.



More information about the Digitalmars-d-announce mailing list