A Refcounted Array Type
monarch_dodra via Digitalmars-d
digitalmars-d at puremagic.com
Thu Mar 5 08:50:03 PST 2015
On Thursday, 5 March 2015 at 16:19:09 UTC, Marc Schütz wrote:
> On Thursday, 5 March 2015 at 15:20:47 UTC, monarch_dodra wrote:
>> On Monday, 23 February 2015 at 22:15:54 UTC, Walter Bright
>>> E array;
>>> size_t start, end;
>>> int* count;
>> What is the point of keeping start/end? Aren't those baked
>> into the array slice? Not storing start end means not having
>> to do index arithmetic (minor), reducing struct size (always
>> nice). But more importantly, it allows implicit (and
>> conditional) bounds checking (awesome), which actually runs
>> regardless anyways.
>> Or did I miss something?
> `GC.free()` needs a pointer to the start of the allocated
> block; it will not release memory if it gets an interior
> pointer. But as far as I can see, one pointer that stores the
> original address should be enough.
Still, you shouldn't need "end", and bounds checking would "just
More information about the Digitalmars-d