Struct beeing moved around

Benjamin Thaut code at benjamin-thaut.de
Fri May 20 05:14:11 PDT 2011


The following program:

import std.stdio;

struct test {
   this(this){
     writefln("postblit");
   }

   int foo;

   this(int i){
     foo = i;
     writefln("%x",&foo);
   }

   ~this(){
     writefln("%x",&foo);
   }
}

void main(string[] args){
      test t = test(5);
}


Gives me this output on dmd 2.052:
18fe58
18fe54

Is this a bug in 2.052? (Doesn't happen with 2.053)
Why did the location of the struct change?
Is there any way to get informed about a struct beeing moved?
Is there a way to prevent it?
-- 
Kind Regards
Benjamin Thaut


More information about the Digitalmars-d mailing list