> I don't know any modern C compiler that will do the wrong thing about
> alignment. We have just to define structures in a compiler-independent
> way and to handle any further endianness problem in the code itself rather
> than in the structure definition.
An alternative might be to "define" structures with #defines for the
offsets of fields within the structure, and use those offsets in indices
into "pd", as is done in "packet-arp.c" (done as part of changes to cope
with the fact that there are fields with what are, in effect, variable
offsets, given that hardware addresses in ARP packets don't have a fixed
length). Note that we already have field *lengths* "defined"
independently of structure definitions, e.g.:
add_item_to_tree(ip_tree, offset + 10, 2, "Header checksum: 0x%04x",
iph.ip_sum);
in "packet-ip.c", rather than, say
add_item_to_tree(ip_tree, offset + 10, sizeof iph.ip_sum,
"Header checksum: 0x%04x", iph.ip_sum);
and, for that matter, note that it says "offset + 10" rather than, say,
"offset + offsetof(e_ip, ip_sum)".
I.e., currently we let the compiler do *some* of the work of figuring
out field offsets and lengths, but not all of it; we might want to have
it do all the work, or have it do none of it.