Question
Default struct fields alignment
Hello,
which is the default struct fields alignment policy of GCC, on STM32 MCU?
I have the following structure:
typedef struct
{
uint32_t param1;
float param2;
uint16_t param3;
} PARAM_T;
I expected a size of 10 bytes, but it is 12 instead, because a two bytes padding has been inserted between param2 and param3, to align this last one to a 4 bytes multiple address.
Why this padding has been added?
'param3' is a uint16_t field, so I expected a 2 bytes address alignment and not a 4 bytes one.
'param3' is a uint16_t field, so I expected a 2 bytes address alignment and not a 4 bytes one.
Thank you,
Carlo
