Alignment of dynamic arrays
bearophile via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jan 8 16:23:46 PST 2015
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.
In past I suggested to put the alignment of an array in the D
type system, as an optional extra information (if the alignment
is not correct this causes compile-time errors in some cases and
some run-time errors when the slicing bounds are runtime values).
Bye,
bearophile
More information about the Digitalmars-d
mailing list