learn some d those days, can't understand the code here

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 13 08:50:42 PST 2016


On Friday, 12 February 2016 at 20:13:16 UTC, Junfeng wrote:
> seems the code try to allocate an array with size from.length, 
> but after cast, the length at offset 0 will be 0, so assert 
> fail(why dmd allow this cast here? I try use GC.malloc and cast 
> in my small test app, dmd will error "Error: cannot cast 
> expression malloc(400LU, 0u, null) of type void* to Node[]").

I'm pretty sure that allocator.allocate returns a void[] or 
ubyte[] rather than a pointer.

Which allocator is being used here? When I played with the dcd 
backend libraries I found it worked best with the Mallocator it 
includes and other things were kinda unreliable.


More information about the Digitalmars-d mailing list