Makes sense - thanks for the info.

On Fri, Jul 5, 2019 at 3:15 PM Alan Cox <alan@llwyncelyn.cymru> wrote:

> On Thu, 4 Jul 2019 17:35:15 -0700
> Jacob Jennings <jacob.r.jenni...@gmail.com> wrote:
>
> > Hello,
> >
> > I am fond of using __attribute__((packed)) to document register
> definitions
> > in this manner:
> >
> > typedef struct BitField {
> > bool b7;
> > bool b6;
> > bool b5;
> > bool b4;
> > bool b3;
> > bool b2;
> > bool b1;
> > bool b0;
> > } __attribute__((packed)) BitField;
> >
> > Would I expect sdcc to generate packed structs without the attribute in
> > this case? -fpack-struct=1 is unsupported, and __attribute((packed))__
> > presents a syntax error.
>
> Yes.
>
> I ended up with a define __packed that is null for SDCC and cc65 but
> __attribute((packed)) on other compilers that supported it.
>
> Whilst it's not an SDCC concern the other problem is that some compilers
> will generate safe code for packed field accesses, others don't.
>
> Alan
>


-- 
@jakej
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to