Why are void[] contents marked as having pointers?
Christopher Wright
dhasenan at gmail.com
Tue Jun 2 16:11:53 PDT 2009
Vladimir Panteleev wrote:
> I wasn't suggesting any GC modifications, I was just suggesting that void[]'s TypeInfo "has pointers" flag be set to false.
The suggestion was that void[] be used as ubyte[] currently is, and then
to use void*[] to indicate an array of unknown type that may have pointers.
This works when all pointers are aligned, or when the garbage collector
does not optimize in cases where a type is known not to contain
unaligned pointers.
Alternatively, you can change the runtime to notify the GC on array
copies so it can keep track of type information when you're avoiding the
type system. But it's so easy to get around this by accident, it's not a
reasonable solution (even if it could be made fast).
More information about the Digitalmars-d
mailing list