On Tuesday, 29 October 2013 at 00:45:59 UTC, Manu wrote:
On 29 October 2013 04:33, monarch_dodra <monarchdo...@gmail.com> wrote:

On Monday, 28 October 2013 at 02:44:54 UTC, Manu wrote:

I had a lot of informal conversations with Walter trying to get my head
around the details here.
To my recollection, the intent was that it should behave like C, and that S.alignof must certainly == 128 in that case. It can't work otherwise.
Alignment must be inherited by parent structures.


But is that really what it means though? From the above conversation, it
would instead appear to mean that:
struct S
{
    int i;
    align(128) int j;
}
in this case, the *padding* needed until we reach j is 128 bytes.

It doesn't mean that S itself need to be 128 aligned.


Both should be true, if it's not, it's a bug.


http://dlang.org/attribute.html#align
---
The alignment for the fields of an aggregate does not affect the alignment of the aggregate itself - that is affected by the alignment setting outside of the aggregate.

align (2) struct S {
  align (1):
     byte a;   // placed at offset 0
     int b;    // placed at offset 1
     long c;   // placed at offset 5
}

auto sz = S.sizeof;  // 14
---

My understanding of that is S is not affected by the alignment of its fields.

Reply via email to