Boost logo

Boost Users :

From: Dan Leibovich (dan_at_[hidden])
Date: 2007-03-16 11:27:59


Hi,
I have switched all the 0 pointer cases to use some Null object.
Now everything works fine.
Thanks very much for your help.

One last (I hope) question:

The compilation of this archive produce some compilation warnings, how can I avoid it ?

Thanks again,
 Dan Leibovich

../boost/boost_1_33_1/boost/archive/impl/basic_binary_iarchive.ipp: In member
   function `void boost::archive::basic_binary_iarchive<Archive>::init() [with
   Archive = portable_binary_iarchive]':
portable_binary_iarchive.hpp:116: instantiated from here
../boost/boost_1_33_1/boost/archive/impl/basic_binary_iarchive.ipp:67: warning: choosing
   `boost::archive::version_type::operator unsigned int&()' over `
   boost::archive::version_type::operator const unsigned int&() const'
../boost/boost_1_33_1/boost/archive/impl/basic_binary_iarchive.ipp:67: warning:
    for conversion from `boost::archive::version_type' to `unsigned int'
../boost/boost_1_33_1/boost/archive/impl/basic_binary_iarchive.ipp:67: warning:
    because conversion sequence for the argument is better
../boost/boost_1_33_1/boost/archive/impl/basic_binary_iarchive.ipp: In member
   function `void boost::archive::basic_binary_iarchive<Archive>::init() [with
   Archive = boost::archive::binary_iarchive]':
../boost/boost_1_33_1/boost/archive/binary_iarchive.hpp:51: instantiated from `void boost::archive::binary_iarchive_impl<Archive>::init() [with Archive = boost::archive::binary_iarchive]'
../boost/boost_1_33_1/boost/archive/binary_iarchive.hpp:66: instantiated from `boost::archive::binary_iarchive_impl<Archive>::binary_iarchive_impl(std::istream&, unsigned int) [with Archive = boost::archive::binary_iarchive]'
../boost/boost_1_33_1/boost/archive/binary_iarchive.hpp:80: instantiated from here
../boost/boost_1_33_1/boost/archive/impl/basic_binary_iarchive.ipp:67: warning: choosing
   `boost::archive::version_type::operator unsigned int&()' over `
   boost::archive::version_type::operator const unsigned int&() const'
../boost/boost_1_33_1/boost/archive/impl/basic_binary_iarchive.ipp:67: warning:
    for conversion from `boost::archive::version_type' to `unsigned int'
../boost/boost_1_33_1/boost/archive/impl/basic_binary_iarchive.ipp:67: warning:
    because conversion sequence for the argument is better

-----Original Message-----
From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Robert Ramey
Sent: á 12 îøõ 2007 22:34
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] [Serialization] issue withportable_binary_oarchive

Dan Leibovich wrote:
> Hi,
>
> Do you have any update?
> I will really appreciate any direction on how to proceed.
>
> Thanks
> Dan
>

I did spend a little time with it. I'm not sure what's missing but here is my current test. I did make pass by avoiding usage of a 0 valued pointer. So this suggests that there someing amiss with the serialization of such pointers in this demo.

I'm quite confident this is an issue with this particular archive demo as the test suite explicitly tests for this.

Robert Ramey

#include <boost/archive/text_oarchive.hpp>

#include <boost/archive/text_iarchive.hpp>

#include <fstream>

class A {

public:

int x;

A* a ;

template<class Archive>

void serialize (Archive & ar, const unsigned int version) {

ar & x ;

ar & a ;

};

A() {}

A(int x_) : x(x_), a(0) {} // this fails

//A(int x_) : x(x_), a(this) {} // this works

virtual void foo() {} ; // if removed - another kind of assert };

};

int main() {

char* file = "c:\\temp\\file" ;

std::ofstream ofs(file, std::ios::binary) ;

portable_binary_oarchive oar(ofs) ;

const A a(1);

oar << a ;

ofs.close() ;

A aa ;

std::ifstream ifs(file, std::ios::binary) ;

portable_binary_iarchive iar(ifs) ;

iar >> aa ;

}

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


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