Safely moving structs in D
    bitwise via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Mon Jan 23 14:26:58 PST 2017
    
    
  
Is it ok to memcpy/memmove a struct in D?
Quote from here:
https://dlang.org/spec/garbage.html
"Do not have pointers in a struct instance that point back to the 
same instance. The trouble with this is if the instance gets 
moved in memory, the pointer will point back to where it came 
from, with likely disastrous results."
This seems to suggests it's ok to move structs around in memory 
without calling their postblit...but if this is the case, why 
does postblit even exist, if it's not strictly guaranteed to be 
called after the struct has been blitted?
    
    
More information about the Digitalmars-d-learn
mailing list