Why are void[] contents marked as having pointers?

Christopher Wright dhasenan at gmail.com
Sun May 31 19:25:39 PDT 2009


Lionello Lunesu wrote:
> Denis Koroskin wrote:
>> On Sun, 31 May 2009 22:45:23 +0400, Vladimir Panteleev 
>> <thecybershadow at gmail.com> wrote:
>>  
>>> I just went through a ~15000-line project and replaced most 
>>> occurrences  of void[]. Now the project is an ugly mess of void[], 
>>> ubyte[] and casts,  but at least it doesn't leak memory like crazy 
>>> any more.
>>>  
>>> I don't know why it was decided to mark the contents of void[] as 
>>> "might  have pointers". It makes no sense!
>>>  
>>  
>> FWIW, I also consider void[] as a storage for an arbitrary untyped binary
>  > data, and thus I believe GC shouldn't scan it.
> 
> You're contradicting yourself there. void[] is arbitrary untyped data, 
> so it could contain uints, floats, bytes, pointers, arrays, strings, 
> etc. or structs with any of those.
> 
> I think the current behavior is correct: ubyte[] is the new void*.

Even in C, people often use unsigned char* for arbitrary data that does 
not include pointers.



More information about the Digitalmars-d mailing list