i'm currently working on a Port of Embedded Code (on a Freescale S12) so GNU and i hava a issue with unions. i have the following union
typedef signed short sint16;
typedef signed long sint32;
typedef union
{
sint32 Akku;
sint16 AkkuHigh;
sint16 AkkuLow;
} akku_type;
and i want to access the highest 2 byte of the union. The Problem is, that both AkkuHigh and AkkuLow have the same starting adress as Akku. It seems to be compiler specific. My Questions are: Is the there a Compiler Flag which changes the behaviour of the union? Can atribute((align (2))) help me?
Thank you in Advance