<div dir="ltr">On Sun, Jun 30, 2013 at 10:38 AM, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Does anyone have a good model for how the "packed" and "aligned"<br>
attributes interact?<br>
<br>
For example:<br>
<br>
struct Foo __attribute__((packed, aligned(4))) {<br>
    int a;<br>
    char b;<br>
    int c;<br>
};<br>
<br>
struct Foo var;<br>
<br>
It seems that alignof(var) == 4, but alignof(var.a) == 1. This is<br>
surprising to me.<br>
<br>
Is this just a GCC quirk that we've had to emulate or is there a good<br>
reason for it?<br></blockquote><div> </div><div>This is what gcc does.  It's not worth trying to deviate from gcc here.</div><div><br></div><div>-Eli </div></div></div></div>