structure members of packed structures

Hans-Peter Nilsson hp@bitrange.com
Tue Jul 15 05:28:00 GMT 2003


On 14 Jul 2003, Mark Mitchell wrote:
> > and only when used in an expression whose type also
> > doesn't include a packed qualifier.  For example, this should
> > remain valid and supported:
> >
> > struct Packed s1;
> > struct __attribute__ ((packed)) Unpacked *p1;
> > p1 = &s1.u;
>
> This makes sense too, but it is hard to implement what Nathan suggests
> together with what you suggest.

If it's not possible, then that's an important NEWS item.

> Nathan, can we just prevent the assignment?  What if
> comp_type_attributes checked for a mismatch here?

Not sure if you meant to restrict what I pointed out.  I didn't
mean only assigment, but general expressions, e.g.

typedef struct __attribute__ ((packed)) Unpacked Pu;
void f (Pu *);
f (&s1.u);

brgds, H-P



More information about the Gcc mailing list