On 12 August 2017 at 12:04, Samuel Thibault <samuel.thiba...@gnu.org> wrote:
> Peter Maydell, on sam. 12 août 2017 11:53:20 +0100, wrote:
>> The utility of the warning is that it means you get told
>> about stuff that might break on other architectures.
> Sure, I understand that. But here all fields are aligned on their size
> inside the packed structure. So there can't be alignment issues, and the
> compiler should be able to determine that.
Alignment is architecture-dependent, and the compiler
can't know the alignment requirements for every
architecture. There's no rule in C that says that
uint16_t only needs 2 byte alignment and not 4 on
(Also I just noticed 'struct ip6' uses bitfields:
that's badly non-portable if it's trying to
match an on-the-wire layout.)