On Friday 20 July 2007 10:11, Philipp Klaus Krause wrote:
> Hynek Sladky schrieb:
> > I think it is a bug because:
> >
> > struct {
> >    unsigned short CCC:12;
> >    unsigned short READ_BL_LEN:4;
> > } CSD;
> > ----> works as expected (2 bytes long)
> >
> > struct {
> >    unsigned short READ_BL_LEN:4;
> >    unsigned short CCC:12;
> > } CSD;
> > ----> works wrong (3 bytes long)
> >
> > I think that this should work the same way shouldn't it?
>
> AFAIk compilers may align larger struct members to different from
> smaller ones (like aligning ints to 16 bit boundaries, aligning bytes to
> 8 bit boundaries). I suppose it's the sme for bitfields.

I don't know much about sdcc, but what about something like #pragma pack(1) or 
__attribute__ ((packed)), shouldn't this force tight packing ?

Alex



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to