Why are void[] contents marked as having pointers?
Walter Bright
newshound1 at digitalmars.com
Sun May 31 12:41:47 PDT 2009
Vladimir Panteleev wrote:
> I don't know why it was decided to mark the contents of void[] as
> "might have pointers". It makes no sense! Consider:
[...]
> 3) It's very rare in practice that the only pointer to your
> object (which you still plan to access later) to be stored in a
> void[]-allocated array!
Rare or common, it still would be a nasty bug lurking to catch someone.
The default behavior in D should be to be correct code. Doing
potentially unsafe things to improve performance should require extra
effort - in this case it would be either using the gc function to mark
the memory as not containing pointers, or storing them as ubyte[] instead.
More information about the Digitalmars-d
mailing list