Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-11-25 11:42:19


David Abrahams wrote:
> "Robert Ramey" <ramey_at_[hidden]> writes:
>
>> To summarize how we arrived here.
>> =================================
>
> <snip>
>
>> e) So it has been proposed binary_iarchive be re-implemented
>> in the following way
>>
>> iarchive - containg default implementation of load_array
>> binary_iarchive - ? presumablu contains implementaion of load_array
>> in terms of currently defined load_binary
>>
>> Its not clear whether all archives would be modified in
>> this way or just binary_iarchive.

> This is extremely discouraging. After I stated many times that our
> design had been changed so as NOT to modify any code in the
> serialization library, after we put the array-optimized archives in a
> separate sub-namespace so that they could live alongside the existing
> ones in the library, after I offered to put all of the code in some
> remote part of Boost not associated with the serialization library,
> you state that we are proposing to change the serialization library
> code.
>

I was referring to :

> archive/array/binary_iarchive.hpp
> ..................................
>
> class binary_iarchive
> : public array::iarchive<
> array::binary_iarchive
> , archive::binary_iarchive_impl<binary_iarchive>
> >
> {
> template <class S>
> binary_iarchive(S& s, unsigned int flags)
> : binary_iarchive::iarchive_base(s,flags)
> {}
>
> // use the optimized load procedure for all fundamental types.
> typedef boost::is_fundamental<mpl::_>
> use_array_optimization;
>
> // This is how we load an array when optimization is appropriate.
> template <class ValueType>
> void load_array(ValueType * p, std::size_t n, unsigned int
> version) {
> this->load_binary(p, n * sizeof(ValueType));
> }
> };
>

I'm also presuming - maybe incorrectly - that the serialization for
something like a C++ array would contain code to invoke
load_array.

So if I re-compile an existing application and use it to load
a binary_archive created under the previous version of the library
the function load_array will be invoked. The same data
will have been previously serialized with a loop of serializing
each data member. Without knowing when load_array is
invoked, one can't know for sure with the old archives will
in fact be readable. Verifying that previously existing archives
of type binary-?archive will be readable will be a non-trivial task.

Robert Ramey


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