The demise of T[new]
dsimcha
dsimcha at yahoo.com
Sun Oct 18 15:32:58 PDT 2009
== Quote from dsimcha (dsimcha at yahoo.com)'s article
> 8. The first call to opSlice on a T[new] should set a flag that indicates that
> there may be multiple pointers to the underlying memory block. Before that flag
> is set, appends to a T[new] should result in calls to GC.free() to free the old
> block whenever it needs to be expanded (since we can guarantee that we own it
> exclusively). This will help deal with false pointer issues, since D's GC looks
> like it will remain conservative for the foreseeable future.
Scratch this one. It breaks on the following:
T[new] stuff = somethingThatReturnsTnew();
T* ptrToStuffMemory = &(stuff[8]);
stuff ~= otherStuff; // May delete memory referred to by ptrToStuffMemory.
More information about the Digitalmars-d
mailing list