This is because all the elements in DateType are bitfields of a Word. In C
you can actually divide one the integral data types into various fields in a
structure. So in the DateType you have:
typedef struct {
Word year :7; // years since 1904 (MAC format)
Word month :4;
Word day :5;
} DateType;
The whole struct consists only of one Word, and the year member takes up
7bits, month 4 bits and day 5 bits, for a total of 16 bits, hence 2 bytes.
Garth Watkins
----- Original Message -----
From: "Jamie Macleod" <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Sunday, November 05, 2000 4:50 PM
Subject: sizeof(DateType) == 2 ?
> Can someone explain why sizeof(DateType) gives me 2? DateType is a
> structure declared as 3 UInt16 values, and of course if I do a
> (sizeof(UInt16) * 3) I get 6. Shouldn't I be getting 6 for DateType?
>
> Jamie
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/