std.allocator needs your help

Benjamin Thaut code at benjamin-thaut.de
Mon Sep 23 09:47:56 PDT 2013


Am 23.09.2013 16:16, schrieb Andrei Alexandrescu:
> On 9/23/13 7:07 AM, Manu wrote:
>> On 24 September 2013 00:04, Andrei Alexandrescu
>> <SeeWebsiteForEmail at erdani.org <mailto:SeeWebsiteForEmail at erdani.org>>
>> wrote:
>>
>>     On 9/22/13 10:20 PM, Benjamin Thaut wrote:
>>
>>         Am 23.09.2013 01:49, schrieb Andrei Alexandrescu:
>>
>>             Hello,
>>
>>
>>             2. Untyped allocator - traffics exclusively in ubyte[].
>>
>>
>>         Why "ubyte[]" and not "void[]"?
>>
>>
>>     It's the logical choice at this level.
>>
>>     ubyte[] == "these are octets"
>>
>>
>> Isn't that what void[] also means?
>> Except it says "these are un-typed octets, ie, not a sequence of typed
>> integers in the range 0-255".
>
> I think void[] means "objects of unknown type".
>
> Andrei
>

I always understood void[] as block of unkown data. Which a allocator 
should return in my opinion. Whats the point of "void" having a size in 
D if we still do it the C way? In my opinion ubyte[] is a array of 
values in the range of 0-255 like manu says. Also if you get a ubyte[] 
you might get the opinion that it is initialized to all zeros or 
something. Which might not be true for all allocators (performance ...)
If you get a void[] you know, all bets are off, and you have to check if 
the allocator preinitialized it or not.

Kind Regards
Benjamin Thaut


More information about the Digitalmars-d mailing list