std.allocator needs your help

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Sep 23 10:08:58 PDT 2013


On 9/23/13 9:47 AM, Benjamin Thaut wrote:
> 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.

You might be right. For example, ubyte[] allows arithmetic on its 
elements, which is something one shouldn't ever care to do in an 
allocation library.

I'm unclear on what void[] means starting from its semantics. That said, 
I replaced ubyte[] with void[] throughout my existing code and it works.


Andrei



More information about the Digitalmars-d mailing list