Alignment of dynamic arrays

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 9 03:18:20 PST 2015


On 1/9/15 6:08 AM, Robert burner Schadek wrote:
> 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.
>

not 16 bit, 16 byte.

-Steve


More information about the Digitalmars-d mailing list