Boost logo

Boost :

Subject: Re: [boost] [endian] Some suggestions
From: Thijs van den Berg (thijs_at_[hidden])
Date: 2016-04-12 10:12:58


On 12 April 2016 at 15:54, Rene Rivera <grafikrobot_at_[hidden]> wrote:

> Sorry to but in..
>
> On Tue, Apr 12, 2016 at 7:48 AM, Thijs van den Berg <thijs_at_[hidden]>
> wrote:
>
> > > Bjorn Reese wrote:
> > >
> > >>
> > >> If, however, you use the NaN payload to convey information, such as
> > >> errors or diagnostics, then the compiler generated payloads can cause
> > >> interoperability problems.
> > >>
> > >
> > There are two type of interoperability IMO:
> > 1) a single program read and writes bytes to memory or disk
> > 2) two different compilations of a program that run on (an have been
> > compiled for) different machines and which want to exchange floats via
> some
> > form of serialisation.
> >
> > From what I've understood the scope of the endian library is to support
> 1),
> > and the wider scope of 2) would be more for a serialisations type of
> > library. I'd expect that 1) would probably not have interoperability
> > issues, whereas 2) potentially can?
> >
>
> That logic doesn't follow for me. If I replace "float" with "int" in the
> above. The conclusion is different. And I conclude that the Endian library
> is indeed for both #1 and #2. Hence it seems inconsistent to me that the
> library would adhere to different conclusions for some types (i.e. float)
> than the other types (i.e. base 2 types).
>
> The way I interpret terminology is that "endianess" is about the byte
order in multibyte words, you might want to manipulate the low-byte of an
int of float that's stored in a word. A float is a floating point viewof
the bits inside the word, and that view is not fully specified. For int's
you'll also have various possible mappings between the number it represents
and the bitsequence, e.g. ones' and two's complement for signed integers.

The way I see it is that the endian library is about the the byte order
inside a word and not about the layout/represenation of integers and float
into that word?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk