Boost logo

Boost :

Subject: Re: [boost] [endian] Project not maintained
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2016-04-04 21:36:27


On 5/04/2016 05:59, Peter Dimov wrote:
> Andrey Semashev wrote:
>> Since you convert the input value, possibly even losing information,
>> this is no longer about endian conversion but rather serialization. At
>> least, that's not what I expect from an endian library.
[...]
> Yes, if your platform's float can't be represented exactly in IEEE 32
> bit, or if IEEE 32 bit can't be represented exactly in your platform's
> float, the roundtrip will not be perfect. Making the library not work
> purely out of spite is of no help though. The file still has 32 bit IEEE
> little-endian floats in it and you're expected to read or produce it.
> This is the task that the library is supposed to solve.

I think Andrey is correct that this is essentially a serialisation problem.

But I agree with Peter that this is exactly the purpose of an Endian
library -- to perform portable serialisation/deserialisation of values
from a defined serialised format (which mostly consists of the
endianness, but for floats can include other factors such as specifying
IEEE format vs. some other format) to native memory format and back again.

There's no particular reason why the library couldn't also contain
conversions for some specific non-IEEE floating point format, if one is
sufficiently popular or appears in well-known file formats such that it
might be useful.

And it could be extensible to other formats not representable in basic
C++ types, such as rational numbers or quad precision floats. They just
need a well-defined block-of-bytes representation and an equivalent C++
class.

But those things are probably beyond the scope of the initial release.


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