Subject: Re: [boost] Any interest in bitstream class?
From: Paul Long (plong_at_[hidden])
Date: 2013-06-28 18:50:07
On 6/28/2013 3:44 PM, Klaim - Joël Lamotte wrote:
> I meant platform A uses one endianness, platform B uses another, but if i
> put data from either into the bitstream, the bitstream will use one
> specific endianness whatever the platform.
> Which is basically what you describe (the network packet case indeed) if I
> understood correctly.
Correct, but it is important to note that integrals are always encoded
big endian in the bitstream. I suppose it's possible that someone would
want some other endian, but that's got to be an obscure use case.
Actually, I can think of an example. Years ago, I worked on a WinTel,
little-endian product, and a colleague didn't use any serialization for
passing objects between two network components. The thinking was, pshaw,
it'll always be a Windows product, so why bother with serialization.
Then, of course, Apple paid us to port it to their 68000, big-endian
platform while maintaining interoperability. In a use case like this, it
might be useful to support other-than-big endianness. What do you think?
Should the bitstream library support multiple endian schemes in the bit
stream or is big endian enough?