Boost logo

Boost :

Subject: Re: [boost] Candidate for 1.66.1, if there is one
From: Peter Dimov (lists_at_[hidden])
Date: 2017-12-24 17:04:47


James E. King, III wrote:

> This leads me to wonder if serialization is compatible across platforms
> and if it is *supposed *to be compatible across platforms. Is this a
> bug?? Shouldn't binary serialization be the same size on every platform,
> assuming platform-specific types are not used?

As far as I know, the built-in binary archives are completely
platform-dependent, in both size and endianness.

It should be possible to create portable ones based on Endian's buffer
types, one just needs to choose an appropriate size for 'int' (32 bits would
probably be fine here) and 'long' (32, 48, or 64? hard to say.)

Another approach is to make the portable archives only take uintN_t. This
takes care of the size, but since those types are typedefs, if you serialize
an int, you still get a non-portable result. Myself, I prefer to use the
basic types.


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