packed/aligned structs problem

I’m porting a DOS application to QNX 6.2.0.
The following struct refuses to be 33 bytes long,
the problem seeming to be around the bit fields.
Although allocated 8 bit, they consume 16.
I’ve tried putting the bit fields in a struct
with its own packed attribute, but still
no success.

Any ideas-I’m fresh out of any!

union {
char buffer[200];
struct {
unsigned char Frame_Synch_Word1;
unsigned char Frame_Synch_Word2;
unsigned char Packet_Size;
unsigned char Message_ID;
unsigned short adclog_ss;
signed short adclog_bse;
unsigned channel : 3;
unsigned def_channel : 3;
unsigned spare8 : 2;
unsigned short sl_start_count;
unsigned short sl_crc_errors;
unsigned short sl_hours;
unsigned short sl_bit_index;
unsigned short adclog_fwd_pwr;
unsigned short adclog_refl_pwr;
unsigned short bfl_1;
unsigned short bfl_2;
unsigned short bfl_3;
unsigned short bfl_4;
unsigned short bfl_5;
unsigned short Uplink_CRC_Word;
} field attribute((packed));
} rfh_temp_rx;

Alex Cellarius <acellarius@systems104.co.za> wrote:

Any ideas-I’m fresh out of any!

} field attribute((packed));

} attribute((packed)) field;

p.s. Also note that the ordering of fields within the
bitfield is unspecified, so be prepared to reverse them.

On 27 Jan 2003 21:33:12 GMT, John Garvey <jgarvey@qnx.com> wrote:

Alex Cellarius <> acellarius@systems104.co.za> > wrote:
Any ideas-I’m fresh out of any!

} field attribute((packed));

} attribute((packed)) field;

p.s. Also note that the ordering of fields within the
bitfield is unspecified, so be prepared to reverse them.

Thank you!