Hi all,
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
Vital Cruvinel
S&V Consultoria (Brazil)
Jim Schram wrote:
Because integer fields of structures prefer to align themselves on
natural 16-bit or 32-bit
word boundaries. If you don't want this behavior, and instead want each
field to use only the
number of bits you've defined, use #pragma options align=packed
before the structure definition
and #pragma options align=reset afterwards.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/