Re: align(n) outside struct useless?

2017-02-20 Thread kinke via Digitalmars-d-learn
On Monday, 20 February 2017 at 22:45:09 UTC, Adam D. Ruppe wrote: I don't believe it does anything (except perhaps pad bytes again) for a stack-defined struct. LDC does respect explicit type-alignments when allocating instances on the stack. The instances are obviously padded to their full s

Re: align(n) outside struct useless?

2017-02-20 Thread Adam D. Ruppe via Digitalmars-d-learn
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 a

Re: align(n) outside struct useless?

2017-02-20 Thread Ali Çehreli via Digitalmars-d-learn
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 w

align(n) outside struct useless?

2017-02-20 Thread Michael Coulombe via Digitalmars-d-learn
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; } p