align(n) outside struct useless?
Michael Coulombe via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Feb 20 12:45:27 PST 2017
I can't figure out how to set the alignment of a struct using
align(n) on the outside of the struct. Only align on the fields
(default or annotated) seems to work. I get the same results back
to at least DMD 2.065... Is this a bug or am I using it wrong?
align(32) struct A { ubyte padding; }
pragma(msg, A.alignof); => 1
align(32) struct B { align(32) ubyte padding; }
pragma(msg, B.alignof); => 32
struct C { align(32) ubyte padding; }
pragma(msg, C.alignof); => 32
align(32) struct D { int padding; }
pragma(msg, D.alignof); => 4
More information about the Digitalmars-d-learn
mailing list