DMD 0.177 release

Andrei Alexandrescu (See Website for Email) SeeWebsiteForEmail at erdani.org
Thu Dec 14 17:02:20 PST 2006


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.


Andrei



More information about the Digitalmars-d-announce mailing list