[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [lwip-users] IP Address Display Functions

From: Kieran Mansley
Subject: RE: [lwip-users] IP Address Display Functions
Date: Tue, 25 Aug 2009 10:24:27 +0100

On Mon, 2009-08-24 at 14:58 -0400, Bill Auerbach wrote:
> If there's an argument that packing is
> required for a single member struct, I'm interesting seeing the reason or
> proof that it's required.

I wonder if it's because without it a compiler would be free to pad it
up to a 64-bit field for example.  A single member struct differs here
from a normal variable because I'm not sure if packing on an outer
struct would also force packing on the inner struct.

All this is conjecture rather than chapter and verse though.

In general a compiler will only using padding to align fields to their
natural boundary (e.g. a 16-bit field to a 16-bit boundary) but if the
spec allows a compiler to use it in other cases, e.g. to align sizes of
fields to a more efficient size (e.g. a 16-bit field to a word), then we
may still need to explicitly pack it.

It might be worth looking through the CVS history to work out why this
particular case was introduced in the first place.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]