Subject: Re: issues with 802.11 radiotap
To: None <>
From: David Laight <>
List: tech-net
Date: 07/12/2005 08:02:07
On Mon, Jul 11, 2005 at 04:56:21PM -0500, David Young wrote:
> I use __packed__ to avoid gratuitous padding by the compiler: IIUC,
> it would be perfectly ok, as far as the C standard is concerned, if
> the C compiler for a 64-bit machine aligned *every* struct member on a
> 64-bit boundary.  Correct me if I'm wrong.

IIRC the standard only required that struct members be in increasing
address.  However C compilers are really expected to do (and usually do)
the obvious thing.
Since __packed__ is a compiler specific language extension, and the
compiler that supports it doesn't add gratuitous padding, it is at
best pointless.
> There is some question in my mind whether compilers like gcc generate
> efficient code for __packed__ structs, even if members are naturally
> aligned.  Perhaps there is a more appropriate compiler directive?

It has to generate the 'slow' code because spcifying __packed__ is
necessary if the entire structure might be misaligned.


David Laight: