Memory Corruption with AAs

Walter Bright newshound1 at digitalmars.com
Fri Apr 2 13:53:00 PDT 2010


dsimcha wrote:
> I almost never do this with any data structure other
> than an array because, even if it works for now, I consider it a horrible
> violation of encapsulation because you're relying on the details of how the data
> structure manipulates memory.  This is also why, when I designed RandAA I didn't
> see this as an issue until you pointed it out to me.

Andrei is working on the design of the D collection class library. After much 
thought and research, he finally came to the conclusion that a collection class 
should not allow the address of a member to be taken. I think his reasoning on 
the issue is pretty sound, and is consistent with your take on it.



More information about the Digitalmars-d mailing list