I'm just asking this question out of curiosity; a very similar question was
posed on the seemingly defunct PalmBoulevard developers board and is so far
unanswered.
I once had a really hard-to-trace bug involving reading information created
from Visual Basic into structs in a PalmOS program. When I finally found
the source of the bug, I was surprised and perplexed by it. Can anyone
explain the phenomenon below?
In short, the bug was caused by the fact that the two structs below both
satisfy:-
sizeof(AB) = sizeof(AB2) = 4.
Admittedly I'm new to C, but this seems incredibly odd to me. Why are the
struct sizes the same? Are the sizes of structs restricted to even numbers
for system reasons, or what?
struct
{
UInt8 a;
UInt16 b;
} AB;
struct
{
UInt16 a;
UInt16 b;
} AB2;
Yours curiously,
Simon
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/