[D1] gc safety

%u e at ee.com
Sun Oct 10 11:40:00 PDT 2010


How gc unfriendly is an union of objects and sizet_t?

union{
  size_t arr[10];
  Class obj[10];
}


And, if multiple arrays contain exclusively the same objects, is it then
safe/useful to mark all but the smallest array with gc.hasNoPointers?
Any object removal/addition happens simultaneous across all the arrays.

void remove(size_t i){
  size_t i2 = arr[i].i2;
  arr2[i2] = null;
  arr[i] = null;
}

ps. I was tempted to make the subject "[D1,gc(safety),union]"..


More information about the Digitalmars-d-learn mailing list