Boost logo

Boost :

From: Matthias Troyer (troyer_at_[hidden])
Date: 2005-09-14 11:01:46


On Sep 14, 2005, at 2:57 AM, troy d. straszheim wrote:

> Hi Robert, boost...
>
> I've implemented a portable binary archive, wondering if there is
> general interest. I've tested (very thoroughly) on our target
> platforms, which are 32 and 64 bit linux, and osx on a g5, each
> platform
> reads and writes archives written by the others, down to the bit.
>
> The archive itself is stored little-endian (as the vast majority of my
> users are on intel hardware) so big-endian platforms are
> responsible for
> byteswapping, though this could be configurable. The problem types
> are
> (unsigned) long int and long double. For long int, the archive checks
> to see if it is small enough to fit into 32 bits, if so it stores
> it in
> 32 bits, otherwise it throws.

This seems to be fine if all you want is compatibility at the level
of the least common denominator. By checking if the value of an
integer fits into 32 bits you make this library archive useless for
people who might need compatibility between 64 bit platforms. What do
you think about the following idea: the portable binary archive
implements serialization for the fixed length integers (int32_t,
int64_t, ...) and it is the user's responsibility to only use the 32
bit integers if they want portability to all 32 bit platforms. Also
watch out that on some platforms even short and int are 64 bit.

Matthias


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