Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-03-16 13:40:00


Dan Leibovich wrote:
> Hi,
> I have switched all the 0 pointer cases to use some Null object.
> Now everything works fine.

Your situation highlights a bug somewhere and I'm still concerned
about this.

I am getting closer to this. Its a bug in portable_archive demo
related to sign extension for certain negative values. This has
cropped up in the case of storing a negative char value which
is class_id. I'm not sure that this doesn't come up with other
cases so you might be a little careful in using portable binary
archive.

> Thanks very much for your help.

and for yours.

>
> One last (I hope) question:
>
> The compilation of this archive produce some compilation warnings,
> how can I avoid it ?

I'm not getting this with my vc 7.1 compiler using the HEAD so I guess
they've been addressed. You might also double check the recent changes
I've made in the HEAD made to binary archives based on your
case.

Robert Ramey

>
> 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 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