On Thu, 14 Nov 2024, Geert Uytterhoeven wrote:
On Sun, Oct 27, 2024 at 7:16 AM Finn Thain <fthain@xxxxxxxxxxxxxx> wrote:
On Sun, 27 Oct 2024, Thorsten Glaser wrote:
Finn Thain dixit:
That would mean __alignof__(foo.b) == sizeof(foo.b) but that's not the
case on my Linux/i686 system. 4 != 8:
struct baa {
int a;
long long b;
} foo;
That struct is just 12 bytes for you then?
Right. i686 and m68k agree on that.
On i686 (i.e. gcc -m32 on amd64):
__alignof__(long long) = 8
but
sizeof(struct baa) = 12
__alignof__(struct baa) = 4
???
My i686 compiler agrees with your compiler. Whereas on Linux/m68k,
__alignof__(struct baa) == 2. On NetBSD/m68k I get,
sizeof(struct baa) == 16
__alignof__(long long) == 8
__alignof__(struct baa) == 8
Isn't the alignment of a struct the largest alignment of any of its members?
Sometimes...