Behaviour of AAs after initialization
via Digitalmars-d
digitalmars-d at puremagic.com
Thu Aug 7 04:46:48 PDT 2014
AAs are (like regular dynamic arrays) initialized to `null`. On
first modification (i.e. assignment of an element), memory is
allocated and the AA variable updated to point at it.
However, is there a guarantee that AAs are never reallocated once
they are initialized, i.e. is it then safe to assume that changes
made through a copy of an AA variable (e.g. pass by value) are
visible through the original variable?
The current implementation behaves like this, but the language
reference does not mention it, AFAICS. I'd like to amend the
documentation if this behaviour is reliable.
This is the thread where the question came up:
http://forum.dlang.org/post/qnllglkrrgfdpwbmvwsp@forum.dlang.org
http://forum.dlang.org/post/tguaxwqijnkqszghauia@forum.dlang.org
More information about the Digitalmars-d
mailing list