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

Aaron J. Grier aaron at frye.com
Tue Jul 11 20:56:51 UTC 2006

On Tue, Jul 11, 2006 at 12:52:06PM -0500, Jay Monkman wrote:
> 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=

the original commits for the packed changes were done in 1999, and in a
couple cases, these changes have been backed out.

gcc4's builtin memcpy recently demonstrated trouble on MIPS with packed
structs and misalignment as well, prompting a re-examining of the use of
__attribute__ ((packed)).

explicitly performing direct copies from/to members of a struct (of
default alignment) to/from an array of desired alignment (8/16/32)
appears to me the most robust way.

  Aaron J. Grier  |   Frye Electronics, Tigard, OR   |  aaron at frye.com

More information about the users mailing list