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

Linus Torvalds
2015-04-22T21:48:40Z

On Wed, Apr 22, 2015 at 1:02 PM, Havoc Pennington <hp@pobox.com> 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