Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-12-25 19:52:45


I looked into this some.

the code for Circle looks good to me and should work.

Note that the error is with casting 'boost::archive::detail::basic_oarchive'
rather than you Circle type.

in smart_cast.hpp I find

static T cast(U & u){
// if we're in debug mode
#if ! defined(NDEBUG) \
|| defined(__BORLANDC__) && (__BORLANDC__ <= 0x560) \
|| defined(__MWERKS__)
// do a checked dynamic cast
return cross::cast(u);
#else
which looks to me that it always does a dynamic cast in debug mode.
I don't know why I did this - but you might experiment with changes here.

Note that the polymorphic archives as currently implemented will require a
dynamic_cast
on the archive class.

I believe that using the serialization library without RTTI should be
possible
but In never assembled a subset of the tests to really check it. I did I
did make
on test to verify the interoperability for different type info systems but I
left it at that.

Robert Ramey

"Yan Drugalya" <ydrugalya_at_[hidden]> wrote in message
news:2441427d0712250730j1455a84ancbee564a1b8c17b6_at_mail.gmail.com...
Folks,

I have class some class Circle which is derived from Shape class. I want to
get rid from RTTI.
In order that I did following:

BOOST_CLASS_TYPE_INFO(
    Circle,
    extended_type_info_no_rtti<Circle>
)
BOOST_CLASS_EXPORT(Circle)

const char * Circle::get_key() const {
    const boost::serialization::extended_type_info *eti
        = boost::serialization::type_info_implementation<Circle>
            ::type::get_instance();
    return eti->get_key();
}

But even after that, if I try to compile project a lot of waring appear:

warning C4541: 'dynamic_cast' used on polymorphic type
'boost::archive::detail::basic_oarchive' with /GR-; unpredictable behavior
may result
it also fails with exception during runtime.
What also need to be done to completely get rid form RTTI

_______________________________________________
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