Peter Maydell, on sam. 12 août 2017 12:18:16 +0100, wrote:
> 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
> There's no rule in C that says that uint16_t only needs 2 byte
> alignment and not 4 on some hosts.
Are there really systems where that happens? Such systems would have to
pad uint16_t arrays then, really?
> (Also I just noticed 'struct ip6' uses bitfields:
> that's badly non-portable if it's trying to
> match an on-the-wire layout.)
struct ip has been doing so for so long too.
I'm not saying the code is perfectly portable, I'm just saying it's
portable enough for being both practical and readable.