At 5:57 PM +0000 2001/06/15, Vital Cruvinel Ferreira wrote:
>I used the pragma options below and the sizeof  (T) returns the size
>expected, but I can't use it (it causes an error at run time). The code
>is:
>
>#pragma options align=packed
>typedef struct {
>   UInt8 size8 : 8;
>   UInt16 size16 : 16;
>   UInt32 size32 : 32;
>} T;
>#pragma options align=reset
>
>T t;
>t.size8 = 3;   // ok
>t.size16 = 5;   // runtime error

This would be a compiler bug. Disassemble the function and check to see if the 
generated code isn't taking the packing restriction into account, substituting 
multiple byte operands for word operands.

Are you using CodeWarrior or some other compiler? Verify "#pragma options 
align=packed" and "#pragma options align=reset" are supported by your compiler.

Regards,

Jim Schram
Palm Incorporated
Partner Engineering


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

Reply via email to