Alignment of dynamic arrays

Luc Bourhis via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 8 16:06:22 PST 2015


With "auto a = new double[1000]", is there any guarantee that  
a.ptr is aligned on a 16-byte boundary? Indeed I would like to 
use core.simd and this alignment is paramount for efficient 
loading from memory to SSE2 registers.

On MacOS X and 64-bit Linux, it looks true for dmd. Looking at 
the implementation of arrays, it seems that it eventually depends 
on gc_malloc implementation but I could not find the code of that 
extern(C) function.


More information about the Digitalmars-d mailing list