[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
回复: PR 1098: "struct ipovly" not packed.
- Date: Tue, 11 Jul 2006 14:04:52 +0200
- From: ralf.corsepius at rtems.org (Ralf Corsepius)
- Subject: 回复: PR 1098: "struct ipovly" not packed.
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