??: PR 1098: "struct ipovly" not packed.

Jay Monkman jtm at smoothsmoothie.com
Tue Jul 11 17:52:06 UTC 2006


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





More information about the users mailing list