Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization] Strange giant warning
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-03-11 05:02:22


On Wed, Mar 10, 2010 at 9:31 PM, Robert Ramey <ramey_at_[hidden]> wrote:
> OvermindDL1 wrote:
>> On Tue, Mar 9, 2010 at 6:38 AM, Avi Bahra <avibahra_at_[hidden]>
>> wrote:
>>> This is caused by a bug in the boost serialisation, well at least in
>>> 1.39 Where is assumes that shared ptr must be polymorphic
>>> I have already reported a similar problem.
>>> i.e
>>
>> Oh I *SO* hate that bug, so very much.
>
> what makes you think it's a bug in serialization library?
>
> If I recall correctly, the motivation for the warning is
> the following.
>
> class base { // no virtual functions here !!
>    ...
> };
>
> class derived : public base {
>    ...
> };
>
> BOOST_CLASS_EXPORT(derived);
>
> ...
>
> base * b = new derived;
> ar << b;  // b will be "sliced" - only the base class part will be
> serialized !!!
>
> In this case the user is almost certainly making a mistake which will be
> exceeding difficult to find.  What's more, he well probably have to send
> inumermable emails to this list alleging that the serialization library has
> a bug and I will have do debug his program for him..  If you want

There is no hierarchy in my case, in fact it is just a struct with
data members and shared_ptr's that link everything together, it does
not compile, that is pretty irritating to have to create a freaking
virtual function in a struct when it holds nothing but data.


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