Cliff Green wrote:
Probably answered before, but I wondered whether there is a standard implementation for portable binary archives available.
[snip]
If you're talking about portable binary archives for Boost.Serialization, there's been talk, but I'm not sure what the status is - anyone have an implementation? I'd be willing to help / work with someone on it.
[snip]
Integral byte swapping is pretty straight forward, but floating point is not - besides the obvious representation issues (e.g. IEEE 754 or not), there's some non-obvious issues dealing with floating point normalization and special values (infinity, etc). For example, I wrote one template function which returned (by value) byte swapped entities, but found it would silently change floating point values depending on the value, platform, compiler version, register usage, etc. Turns out normalization would occur on the "by value" return, changing bits in the byte swapped floating point number.
I'd be willing to help out with the floating point issues. Last fall I wrote a library with portable fpclassify, isnan, signbit etc. (It is available in the vault in the Math - Numerics folder.) Several Boosters tested the library with more than 20 different OS / compiler / processor combinations. This experience taught me a lot about portable handling of floating point numbers. --Johan Råde