回复: PR 1098: "struct ipovly" not packed.
Ralf Corsepius
ralf.corsepius at rtems.org
Tue Jul 11 12:04:52 UTC 2006
On Thu, 2006-07-06 at 21:22 -0400, Denny.Bai wrote:
> typedef struct {
> long l1;
> short s1;
> long l2;
> } s2_t __attribute__((packed)); /* does nothing */
>
> --------------------------------------------------
>
> if above code changed like this, "__attribute__((packed))" will work
> and the warning will not appear again.
>
> typedef struct {
> long l1;
> short s1;
> long l2;
> }__attribute__((packed)) s2_t;
structs like the ones above are BAD DESIGN.
With or without __attribute((packed))__ there is no guarantee they will
work. If you have a look into the BSD structures we are talking about
here, they are designed in such a way that "packing" should not have any
effect.
Ralf
More information about the users
mailing list