Boost logo

Boost :

Subject: Re: [boost] [Serialization] Bizarre bug
From: Jarl Lindrud (jarl.lindrud_at_[hidden])
Date: 2009-08-05 07:05:30

Jarl Lindrud <jarl.lindrud <at>> writes:

> Robert Ramey <ramey <at>> writes:
> > ar >> ptr isn't. I'll look into it. For now you could work around this by
> > a) including more dummy code.
> > b) removing the dummy code
> > c) explicitly setting tracking for the type to track_alwyas or track_never.
> >
> > Robert Ramey
> Thanks Robert.
> I've entered the issue into trac:
> _______________________________________________
> Unsubscribe & other changes:

I see this issue has now been closed, without a fix.

In my view it's a pretty serious bug, that this code:

    std::vector<char> v0(25, 'A');
    std::vector<char> v1;

    std::ostringstream ostr;
    boost::archive::text_oarchive(ostr) & v0;

    std::istringstream istr(ostr.str());
    boost::archive::text_iarchive(istr) & v1;
    bool ok = (v0 == v1);

, will fail, because of implicit compile-time instantiation in a completely
different part of the program. For the typical user, this is next to impossible
to diagnose, let alone understand. I guess I don't see how this can be thought
of as a design feature.

I would have thought it would be possible to include sufficient metadata in the
output archive, so that B.Ser. is able to correctly deserialize its own output
archives, without depending on implicit compile-time instantiation. Sure, that
would change the archive format, but it would hardly be the first such change,
so I would think whatever backwards compatibility scheme is already in place,
could deal with this as well.

Hope that makes some sense - I don't know very much about B.Ser. internals.


Boost list run by bdawes at, gregod at, cpdaniel at, john at