new or no?
Adam D. Ruppe
destructionator at gmail.com
Sun Dec 23 11:46:28 PST 2012
On Sunday, 23 December 2012 at 19:43:54 UTC, Shadow_exe wrote:
> for(uint y=0; y<10; ++y){
> auto m = new Mutex();
> writeln(&m);
> }
That's the address of the local variable. The object it points to
is somewhere else.
An Object in D is more like an Object* in C++.
Object* o = new Object();
&o == 0
o == 1
o = new Object();
&o == 0 // the local variable is still in the same place
o == 2 // but it now points to a new object
More information about the Digitalmars-d
mailing list