Member access of __gshared global object
    Dragos Carp via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Wed Aug  6 09:06:29 PDT 2014
    
    
  
> This describes the semantics of regular arrays. Are you sure it 
> also applies to AAs? I thought they will keep referring to the 
> same data once they are initialized. But I might be mistaken...
>
This can be easily tested. And... you are right!
In the current implementation (I couldn't find any specification) 
the AA contains just a pointer[1]. I suppose that initially this 
pointer is null and on copy the pointer is copied, so that after 
initialization any change of the copy is visible in the original.
[1] 
https://github.com/D-Programming-Language/druntime/blob/master/src/rt/aaA.d#L82-85
    
    
More information about the Digitalmars-d-learn
mailing list