--- Phong Nguyen wrote:
> I define a structure as follows:
> typedef struct
> {
> Char name[2];
> Char age;
> }
> InfoType;
> I expect that sizeof(InfoType) to be 3. However the
> compiler returned sizeof(InfoType) = 4 !!!!.
The processors currently used by Palm OS devices do not allow
addressing of odd-numbered bytes, so the compiler pads stuff so
everything gets stored at an even address. This is what your struct
looks like to sizeof():
typedef struct
{
Char name[2];
Char age;
unsigned char padding;
}
InfoType;
__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/