Re: Issues with capability bits and meta-data in kdbus

From: Linus Torvalds
Date: Wed Apr 22 2015 - 17:48:46 EST


On Wed, Apr 22, 2015 at 1:02 PM, Havoc Pennington <hp@xxxxxxxxx> wrote:
> * the byte order marker in every message is silly

It's worse than that.

Conditional byte order is worse than silly - it's terminally stupid.

This is not a "per connection" thing or a "every message"; thing. It's
more fundamental than that. Protocols that have dynamic byte orders
are pure and utter crap.

The only sane model is to specify one fixed byte order. Seriously.
It's equally portable, it generates better code - even on
architectures that then have to unconditionally do byte order swapping
- and it's simpler to add static type checks for etc. It's literally
less code and faster to do a "bswap" instruction than to do a
conditional test of some variable (even if you can then avoid the
bswap dynamically),

In other words, think networking, which statically just decided to use
big-endian. Sure, that was the wrong choice in the end, but even
picking the wrong endianness - but picking it statically - is better
than the horrible mistake of thinking that you should have some
variable byte order.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/