Subject: Re: [PATCH] ixgbe: Introduce new 10GbE driver for Intel 82598 based PCI Express adapters...

From: Andrew Morton <[email-masked]>
Date: Mon, 2 Jul 2007 08:52:58 -0700

On Mon, 02 Jul 2007 11:32:41 -0400 Jeff Garzik <[email-masked]> wrote:

> Bitfields are to be avoided for many reasons:
> * more difficult, in general, for a compiler to generate optimal code
> * in particular, known to generate worse code on various architectures
> * often causes endian problems
> * often enhances programmer confusion, when trying to review structs and 
> determine optimal layout and alignment
> * programmers have proven they will screw up bitfields in e.g. cases 
> with 1-bit and signedness.
> 
> I can probably think up more reasons to avoid bitfields if given another 
> 5 minutes :)

A significant problem is that modifications to "nearby" bitfields need
locking: concurrent modifications to two bitfields can result in concurrent
modifications to the same word.

And that's OK, but it's pretty unobvious that these stores are nonatomic
from the source code and people could easily forget to do it.

That being said, they _are_ attractive from the nice-to-read POV...