Rathinavel Vel

Structure alignment problem in Cosmic cross compiler for MC9S12DP256

Discussion created by Rathinavel Vel on May 27, 2006
Latest reply on May 29, 2006 by Oliver Betz
Hello All,
I am using Cosmic C compiler for MC9S12DP256 (16 bit microcontroller)  in my project.
I am facing the following problem
typedef struct {
unsigned char Var1[182];  // 182 bytes
unsigned long  Var2;         // 4 bytes
unsigned char Var3[16];   // 16 bytes
As you see here this structure should take 202 bytes of memory , but when i use sizeof(ABC) --> it returns 204
my doubt is, even though the elements in this structure is align to even position, why the compiler is padding 2 more bytes extra?
Thanks and regards - Rathinavel