www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - static array alignment

reply "John Colvin" <john.loughran.colvin gmail.com> writes:
void main()
     align(128) float[128] a;
     assert((cast(size_t)(a.ptr) & 127) == 0);

the assert fails. What gives?
Nov 30 2014
parent reply "Temtaime" <temtaime gmail.com> writes:
align doesn't work in DMD. There's bugreport for a long time.
Nov 30 2014
parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Sunday, 30 November 2014 at 13:55:16 UTC, Temtaime wrote:
 align doesn't work in DMD.
It does in some places, but not on local variables. I think the best you can do for them is use the core.simd types which are intrinsicially aligned.
Nov 30 2014