Member access of __gshared global object

Puming via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 7 07:38:43 PDT 2014


Yes indeed, null initial value is reasonable. My suggestion does 
not affect that rationale, but is only based on my observation 
that if someone want to `refer` to an AA, he is more likely to 
fill it very soon, and he really mean to refer to it. These are 
similar concerns:

- create a null AA, then fill it, and the compiler/runtime will 
automatically initialize it before the fill.

- create a null AA, then refer to it (and would then use it), and 
the compiler/runtime wil automatically initialize it before the 
refer.


On Thursday, 7 August 2014 at 11:05:33 UTC, Kagamin wrote:
> It's an optimization of memory allocation: you can always have 
> a usable AA without allocating anything for it, so when you 
> fill it with data, you may want to assign it back to where it 
> should stay, similar to a slice.



More information about the Digitalmars-d-learn mailing list