[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1191626841.6416.5.camel@pasglop>
Date: Sat, 06 Oct 2007 09:27:21 +1000
From: Benjamin Herrenschmidt <benh@...nel.crashing.org>
To: Timur Tabi <timur@...escale.com>
Cc: "linux-os (Dick Johnson)" <linux-os@...logic.com>,
Andreas Schwab <schwab@...e.de>,
Jan Engelhardt <jengelh@...putergmbh.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: __LITTLE_ENDIAN vs. __LITTLE_ENDIAN_BITFIELD
On Fri, 2007-10-05 at 15:37 -0500, Timur Tabi wrote:
> linux-os (Dick Johnson) wrote:
>
> > It makes no sense because a bitfield is something having to
> > do with a 'C' compiler and it must NEVER be used as a template
> > to address hardware! 'C' gives no guarantee of the ordering
> > within machine words. The only way you can access them is
> > using 'C'. They don't have addresses like other objects
> > (of course they do exist --somewhere). They are put into
> > "storage units," according to the standard, and these
> > storage units are otherwise undefined although you can
> > align them (don't go there).
>
> Well, if it doesn't make any sense why do we have __LITTLE_ENDIAN_BITFIELD and
> __BIG_ENDIAN_BITFIELD? That is, why do we do this:
.../... (snipped horror use of bitfields)
Bitfields are wrong. Period. Don't use them.
__LITTLE_ENDIAN_BITFIELD vs. __BIG_ENDIAN_BITFIELD is Linux way to cope
with existing code using them that needs fixing on architectures that
have C bitfields in reverse order but that's not even something that can
be properly relied upon generally.
Just don't use bitfields and be happy.
Ben.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists