What's this? (Was: DMD 1.028 and 2.012 releases)

Walter Bright newshound1 at digitalmars.com
Fri Mar 7 01:33:00 PST 2008


Aarti_pl wrote:
> Did you notice this example in docs?
> (http://www.digitalmars.com/d/2.0/struct.html#AssignOverload)
> 
> 
> S* opAssign(S s)
> {   S tmp <== *this; // bitcopy *this into tmp
>     *this <== s;     // bitcopy s into *this
>     tmp.~this();     // call destructor on tmp
>     return this;
> }
> 
> It seems to be something new in D 2.012. Does it work? How?

It's pseudo-code. There is no <== operator nor .~this() in D. I probably 
made a mistake in presenting it this way, but I was trying to show what 
was going on.

The comments explain what is happening.


More information about the Digitalmars-d-announce mailing list