Alignment of dynamic arrays

Robert burner Schadek via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 9 03:08:08 PST 2015


On Friday, 9 January 2015 at 00:23:47 UTC, bearophile wrote:
> Luc Bourhis:
>
>> With "auto a = new double[1000]", is there any guarantee that  
>> a.ptr is aligned on a 16-byte boundary?
>
> Arrays are aligned on a 16-byte. But if you slice them, this 
> alignment can be broken.

IMO, If you slice a double array it is always aligned. Because 
doubles are 8 bytes long aka 64bit which would align them to 
every fourth 16bit boundary.



More information about the Digitalmars-d mailing list