On Monday, 20 February 2017 at 20:45:27 UTC, Michael Coulombe wrote:
I can't figure out how to set the alignment of a struct using align(n) on the outside of the struct.

align(n) on the outside of a struct will pad the struct as a whole to meet that size requirement. So it changes the sizeof and only really aligns when you have an array of the structs. I don't believe it does anything (except perhaps pad bytes again) for a stack-defined struct.

align on the inside will shuffle the padding around in between members or pushing it to the end.

You'll likely want BOTH align, inside and outside, if you want to get a packed array of packed structs...

Reply via email to