align(n) outside struct useless?

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Feb 20 13:07:30 PST 2017


On 02/20/2017 12:45 PM, 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. 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?

However, it works correctly:

enum A = 32;

align(A)
struct S {
     char c;
}

static assert(S.sizeof == A);

Ali



More information about the Digitalmars-d-learn mailing list