On Friday, 16 October 2020 at 21:26:12 UTC, Steven Schveighoffer wrote:
To further explain this -- the padding is added so things like pointer arithmetic on an array work.

In my code sample above one can only access the first element anyhow so I don't understand why this restriction is imposed here.

struct S
{
    int i;
    bool b;
}

struct T
{
S s; // reinterpreting this as an array can only access this first element anyway char c; // so why can't this be aligned directly after `s` without any padding?
}

Reply via email to