I'm working with an struct compiled for a 32bit ARM processor.
typedef struct structure {
short a;
char b;
double c;
int d;
char e;
}structure_t;
If I use nothing, __attribute__ ((aligned (8)))
or__attribute__ ((aligned (4)))
I get the same results in terms of structure size and elements offset. Total size is 24. So I think it is always aligning to 8 (offsets are for both a=0
, b=2
, c=8
, d=16
, e=20
).
Why is 8 the default alignment chosen by the compiler? Should not it be 4 because is a 32 word processor?
Thanks in advance mates.