The Many Faces of D - slides

Walter Bright newshound2 at digitalmars.com
Sun Oct 3 12:47:52 PDT 2010


Michel Fortin wrote:
> On 2010-10-03 09:59:16 -0400, bearophile <bearophileHUGS at lycos.com> said:
> 
>> Page 19:
>>> Unlike C++, values can be moved in memory  Postblit is used to 
>>> “adjust” things after a move<
>>
>> OK, so a moving GC needs to call the Postblit each time it moves a 
>> struct.
> 
> But isn't postblit used only when doing a copy? I think the last word in 
> the quote should be "copy", not "move". So a moving GC does not have to 
> call postblit.

Right.

In D, all struct (and class) instances are, by definition, movable using memcpy().

The advantage is not just enabling a moving GC, but it also enables a whole host 
of optimizations that are not possible in C++.

C++0x tries to address this problem with rvalue references and moving constructors.


More information about the Digitalmars-d mailing list