At 10:00 AM 8/8/2003, Engi wrote:
Hi,

Is someone could explain me this :

sizeof(DateType) = 2
sizeof(Char) = 1

typedef struct
{
 DateType date;
 Char  value;
}
stACTIONS;

sizeof(stACTIONS) = 4 ???

Why sizeof(stACTIONS) is not 3 ?

Because stActions has to be aligned on a two-byte boundary if used in an array. To do this, the compiler adds a byte of padding after "value" so the next item will be properly aligned.


--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com



-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to