Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2008-02-18 13:06:58


Mark Schlegel wrote:
> Boost User list:
>
> I have a question about boost::serialization and portability. When I
> read in the overview for this feature at
> http://www.boost.org/libs/serialization/doc/overview.html
>
> point 7 states that "Data Portability - Streams of bytes created on
> one platform should be readable on any other".
>
> I'm trying to clear up how far portability goes.
>
> I've tested serialization on two different hardware
> platforms (Intel Linux with Boost 1.34.1 and Sparc Solaris with Boost
> 1.33.1) which have different endians.
> The archiving writes and reads fine as long as
> the reading is done on the newer or equal version of Boost. Basically
> I wrote a serialization file with boost::archive::text_oarchive on
> the Solaris
> box and ftped the file to the Linux host and
> read it in fine. But going the other way (1.34.1 ->
> 1.33.1) aborted which is understandable because a
> archive version level change (3 vs 4) existed between those.

> So is readability assured by serialization as
> long as you're going from an older or equal
> version of boost? We can handle our maintaining
> the very latest boost version in our code and
> customers would send us their archives for
> testing and they'd either have the same or older
> version of boost in their copy. Their code would
> never be newer than ours. If this is
> obeyed will their archives always be readable
> by our code?

This is the intention and changes are coded to support this.
So far we haven't recieved any complaints about this so it would seem that
things work as we intend.

Having said this there are a couple of issues.

Backward archive compatibility isn't tested by the test suite. I would like
to
see that happen, but its just too big a job to implement. If you are going
to
rely on this facility, I would suggest that you make specific tests for it
for you serializable types. Assuming that we've made no mistakes in
our implementation of support for previous versions, there is possibility
that code to support older versions of your own types can have bugs.
The main problem is that if you have a bug here and you don't test it,
you won't find out about until its waaaaaaaaaay tooooooo late.
And it will be a major bitch to find the mistake as well.

The issue has been raised that it would be convenient to be able to
to generated older archive versions. At first I dismissed this as not being
implementable
without a huge project. However, a little investigation revealed that it
would indeed be possible with some minor changes. So, I'm inclined to
someday include this facility.

Robert Ramey

>
> Mark


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net