www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Struct toString() & this pointer question

reply Tom <tom nospam.com> writes:
Hey guys,

   having the following code:



























The output was:

Builded a new instance at 910FE0 ((S *)={this=910FE0,m=1234})
Builded a new instance at 910FE0 ((S *)={this=13FEEC,m=1234})
Builded a new instance at 910FE0 ((S *)={this=910FE0,m=1234})

I wonder why is that in the second line, toString is printing an 
alternative this pointer?

Regards,
--
Tom;
Apr 08 2007
parent reply BCS <ao pathlink.com> writes:
Structs are pass by value. The *s pushes the struct onto the stack and then 
the toString function is called on that struct.
Apr 08 2007
parent Tom <tom nospam.com> writes:
Stupid me... of course, thanks!

BCS escribió:
 Structs are pass by value. The *s pushes the struct onto the stack and 
 then the toString function is called on that struct.
 
 
Apr 08 2007