Boost logo

Boost :

From: Boris Gubenko (Boris.Gubenko_at_[hidden])
Date: 2007-11-02 13:51:59


Two serialization library tests: test_demo_portable_archive[_dll] fail
to compile on many platforms with invalid type conversion error. I did
not check all the platforms, but I'd expect it to fail on any big endian
platform. The patch below fixes the problem, verified on HP-UX with
both aC++ and gcc.

Ok to commit?

Index: example/portable_binary_oarchive.hpp
===================================================================
--- example/portable_binary_oarchive.hpp (revision 40687)
+++ example/portable_binary_oarchive.hpp (working copy)
@@ -76,7 +76,7 @@

         // we choose to use litle endian
         #ifdef BOOST_BIG_ENDIAN
- char * first = static_cast<char *>(static_cast<void *>(& l));
+ char * first = reinterpret_cast<char *>(const_cast<long *>(& l));
             char * last = first + sizeof(l) - 1;
             for(;first < last;++first, --last){
                 char x = *last;

Thanks,
  Boris


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