Idea #1 on integrating RC with GC

Namespace rswhite4 at
Wed Feb 5 11:48:57 PST 2014

On Wednesday, 5 February 2014 at 19:42:26 UTC, Adam D. Ruppe 
> On Wednesday, 5 February 2014 at 19:36:00 UTC, Namespace wrote:
>> 	static struct Payload {
>> 		void* ptr;
>> 		int* rc;
>> 	}
>> 	Payload* p;
> Now there's double indirection to get to the data... and you 
> also forgot the necessary postblits and dtors to maintain the 
> reference count. (these could be inlined or elided in some 
> cases, but not all)
> You can't put the rc at the beginning of the pointer either, 
> since then a = a[1..$] won't work. So the added pointer is 
> unavoidable, your way or my way, both have a cost.

Hm, you're right. Would have been nice if the nice syntax could 
be retained, instead of further unsightly library solution.

More information about the Digitalmars-d mailing list