#include <stdio.h>
#include <stdint.h>
//typedef struct
typedef struct __attribute__((packed, aligned(4)))
{
int a;
char b;
char c;
int d;
}structure;
int main()
{
structure st;
printf("%d\n", sizeof(st));
return 0;
}
JAki powinien być rozmiar struktury st oraz rozmiar struktury z atrybutem "packed" na 32 bitowej maszynie.? Z tego co jest napisane w poradniku powinno być 16 bajtów bez atrybutu i 12 z atrybutem.
Próbowałem kompilować u siebie na 32 bitowej maszynie i za każdym razem jest 12 bajtów? Pytanie dlaczego?