Yes, you are right! Looking at the assembly, T.init creates a struct on the stack.
2010/8/29 Stanislav Blinov <stanislav.bli...@gmail.com> > > Torarin wrote: >> >> Hi, >> in std.algorithm move(), this is the operation used to set the source of a >> struct move to .init: >> >> static T empty; >> memcpy(&source, &empty, T.sizeof); >> >> Is there any particular reason why the more compact &T.init is not used? >> > > I may be wrong, but it seems that in this case T.init will yield a temporary, > while static T empty is 'always' there. > > Consider: > > struct S {} > > void main() > { > writefln("%x", &S.init); // prints one value > writefln("%x", &S.init); // prints another value > > static S s; > > writefln("%x", &s); // prints one value > writefln("%x", &s); // prints the same value > }