[serialization] disable BOOST_STATIC_WARNING for track_never objects?
Hi all - It's possible that I'm still doing something questionable, in which case, I hope you'll let me know. If what I'm doing is okay, perhaps there's a way to disable this warning. I have a virtual class hierarchy which I use to pass messages via boost.mpi. These messages then perform dispatch through helper objects on either side of the communication. I want to turn off object pointer tracking, so I've set my classes via BOOST_CLASS_TRACKING(myclass, boost::serialization::track_never). I thought this would just turn it off without a hitch, but I get a huge cascade of warning/error messages stemming from check_pointer_tracking(), where there is a comment that "serializing an object of a type marked "track_never" through a pointer could result in creating more objects than were saved!". If this is expected, how can I turn the warning off? If it is not expected, are there suggestions for what might be changed? Thanks, Brian
Brian Budge wrote:
Hi all -
It's possible that I'm still doing something questionable, in which case, I hope you'll let me know. If what I'm doing is okay, perhaps there's a way to disable this warning.
I have a virtual class hierarchy which I use to pass messages via boost.mpi. These messages then perform dispatch through helper objects on either side of the communication. I want to turn off object pointer tracking, so I've set my classes via BOOST_CLASS_TRACKING(myclass, boost::serialization::track_never).
Turning off pointer tracking IS questionable if one is serializing through ponters! why not just leave it on?
If this is expected, how can I turn the warning off? If it is not expected, are there suggestions for what might be changed?
consider the following alternatives a) understand why the warning is there and ignore it on purpose. Include comments in the source code of your app explaining your decision b) enable pointer tracking c) consider different type of polymorphism - e.g. Boost.Variant which is supported by Boost.Serialzation out of the box d) experiment with serialziation via a base class reference. I don't remember of Boost.Serialization has the smarts to stay ahead of the programmer in this case. Robert Ramey
On Mon, Sep 10, 2012 at 12:29 PM, Robert Ramey
Brian Budge wrote:
Hi all -
It's possible that I'm still doing something questionable, in which case, I hope you'll let me know. If what I'm doing is okay, perhaps there's a way to disable this warning.
I have a virtual class hierarchy which I use to pass messages via boost.mpi. These messages then perform dispatch through helper objects on either side of the communication. I want to turn off object pointer tracking, so I've set my classes via BOOST_CLASS_TRACKING(myclass, boost::serialization::track_never).
Turning off pointer tracking IS questionable if one is serializing through ponters! why not just leave it on?
If this is expected, how can I turn the warning off? If it is not expected, are there suggestions for what might be changed?
consider the following alternatives
a) understand why the warning is there and ignore it on purpose. Include comments in the source code of your app explaining your decision
b) enable pointer tracking
c) consider different type of polymorphism - e.g. Boost.Variant which is supported by Boost.Serialzation out of the box
d) experiment with serialziation via a base class reference. I don't remember of Boost.Serialization has the smarts to stay ahead of the programmer in this case.
Robert Ramey
Thanks for the suggestions. I will leave pointer tracking on. Brian
participants (2)
-
Brian Budge
-
Robert Ramey