public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Timur Tabi <timur@freescale.com>
Cc: "linux-os (Dick Johnson)" <linux-os@analogic.com>,
	Andreas Schwab <schwab@suse.de>,
	Jan Engelhardt <jengelh@computergmbh.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: __LITTLE_ENDIAN vs. __LITTLE_ENDIAN_BITFIELD
Date: Sat, 06 Oct 2007 09:27:21 +1000	[thread overview]
Message-ID: <1191626841.6416.5.camel@pasglop> (raw)
In-Reply-To: <4706A096.4000700@freescale.com>


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.



  reply	other threads:[~2007-10-05 23:28 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-05 18:27 __LITTLE_ENDIAN vs. __LITTLE_ENDIAN_BITFIELD Timur Tabi
2007-10-05 18:35 ` Jan Engelhardt
2007-10-05 19:35   ` Timur Tabi
2007-10-05 19:43     ` Jan Engelhardt
2007-10-05 19:47       ` Timur Tabi
2007-10-05 20:04         ` Andreas Schwab
2007-10-05 20:07           ` Timur Tabi
2007-10-05 20:34             ` linux-os (Dick Johnson)
2007-10-05 20:37               ` Timur Tabi
2007-10-05 23:27                 ` Benjamin Herrenschmidt [this message]
2007-10-05 21:17             ` Andreas Schwab
2007-10-05 21:06     ` Anton Altaparmakov
2007-10-05 21:10       ` Timur Tabi
2007-10-05 21:29         ` Andreas Schwab
2007-10-05 21:32           ` Timur Tabi
2007-10-05 23:17             ` Andreas Schwab
2007-10-09 17:46         ` Lennart Sorensen
2007-10-09 17:56           ` Timur Tabi
2007-10-09 18:34             ` Lennart Sorensen
2007-10-09 18:50             ` Krzysztof Halasa
2007-10-09 18:57               ` Timur Tabi
2007-10-09 19:37                 ` Krzysztof Halasa
2007-10-09 19:44                   ` Timur Tabi
2007-10-09 22:11                     ` Krzysztof Halasa
2007-10-09 19:11               ` Jeremy Fitzhardinge
2007-10-09 19:39                 ` Krzysztof Halasa
2007-10-09 21:40                   ` Jeremy Fitzhardinge
2007-10-09 22:34                     ` Krzysztof Halasa
2007-10-10 12:05                       ` linux-os (Dick Johnson)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1191626841.6416.5.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=jengelh@computergmbh.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-os@analogic.com \
    --cc=schwab@suse.de \
    --cc=timur@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox