[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
??: PR 1098: "struct ipovly" not packed.
- Date: Tue, 11 Jul 2006 12:52:06 -0500
- From: jtm at smoothsmoothie.com (Jay Monkman)
- Subject: ??: PR 1098: "struct ipovly" not packed.
Ralf Corsepius wrote:
>
> 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
That's not what the gcc docs say:
The `packed' attribute specifies that a variable or structure field
should have the smallest possible alignment--one byte for a
variable, and one bit for a field, unless you specify a larger
value with the `aligned' attribute.
If __attribute__((packed)) is so wrong, what's the correct way to ensure a data
structure is packed? If you look at the latest code in netbsd, they use it on
their network data structures:
http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/netinet/tcp.h?rev=1.19.4.1&content-type=text/plain