[serialization] The trouble with BCB2006

Robert, I think I found the problem, but I'm not sure on how to code a workaround. Apparently BCB2006 introduced a bug which causes writes to a BOOST_STRONG_TYPEDEF to fail, just as if a temporary was updated. This is affecting specifically the reading of archive versions. The code below is an example of an effective workaround: version_type input_library_version; #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) && __BORLANDC__ >= 0x580 unsigned int v; * this->This() >> v; input_library_version.t = v; #else * this->This() >> input_library_version; #endif Probably it would be sufficient to just pass input_library_version.t to operator>> . The real problem I have with this workaround is that it would be much better to factor it into BOOST_STRONG_TYPEDEF's definition, but I'm not sure about what is exactly causing the problem and I'm not very confident about my ability to add conditions to a macro definition. Cheers, Nicola Musatti

I was going to make this change and start testing, but I don't think it will work. using something like: *this->This() >> input_library_version.t will lose the "version_type" when the i/o is done. Hence xml attribute tag "version" won't be "matched up" with the value. I would recommend tracing into the following *this->This() >> input_library_version To see why the version_type serialization isn't being invoked. This will likely require tracing down pretty deep until you get to virtual void vload(version_type & t){ * this->This() >> t; } in common_iarchive.hpp. I would test with xml_iarchive to be sure that the actual version is found. At some point along way - hopefully very near the bottom, the t can be replaced with t.t for borland. Or many BOOST_STRONG_TYPE can be fixed for borland. Robert Ramey Nicola Musatti wrote:
Robert, I think I found the problem, but I'm not sure on how to code a workaround. Apparently BCB2006 introduced a bug which causes writes to a BOOST_STRONG_TYPEDEF to fail, just as if a temporary was updated. This is affecting specifically the reading of archive versions.
The code below is an example of an effective workaround:
version_type input_library_version; #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) && __BORLANDC__ >= 0x580 unsigned int v; * this->This() >> v; input_library_version.t = v; #else * this->This() >> input_library_version; #endif
Probably it would be sufficient to just pass input_library_version.t to operator>> .
The real problem I have with this workaround is that it would be much better to factor it into BOOST_STRONG_TYPEDEF's definition, but I'm not sure about what is exactly causing the problem and I'm not very confident about my ability to add conditions to a macro definition.
Cheers, Nicola Musatti
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Robert, I'm afraid I misled you: what I described in my previous post appears to have been some artefact of my testing environment. I'm currently experimenting with test_class_info_load.cpp; this fails because the file version for the B class is read as 1. Here's the archive it is using for testing (testfile_text_archive.hpp): 22 serialization::archive 1 1 1 0 0 I'm not familiar with its format, but I suspect that the archive is wrong in the first place, isn't it? Is it the result of some other test? Cheers, Nicola Musatti

This tests loads in the output created by another test: test_class_info_save.cpp so it could be a problem in that other test. You might find it helpful to use the xml version of these tests (assuming they fail also). This will produce an archive in XML which is self describing. Thanks a lot for helping out here. Robert Ramey Nicola Musatti wrote:
Robert, I'm afraid I misled you: what I described in my previous post appears to have been some artefact of my testing environment.
I'm currently experimenting with test_class_info_load.cpp; this fails because the file version for the B class is read as 1. Here's the archive it is using for testing (testfile_text_archive.hpp):
22 serialization::archive 1 1 1 0 0
I'm not familiar with its format, but I suspect that the archive is wrong in the first place, isn't it? Is it the result of some other test?
Cheers, Nicola Musatti
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Robert Ramey wrote:
This tests loads in the output created by another test: test_class_info_save.cpp so it could be a problem in that other test. You might find it helpful to use the xml version of these tests (assuming they fail also). This will produce an archive in XML which is self describing.
I think I found the cause of the problem I was investigating: for some reason saving version_type data in basic_text_oprimitive results in the stream insertion operator's bool overload being called, which in turn causes the ones in my previous example being written. Adding an overload for version_type to basic_text_oprimitive::save() solves the problem. I heve still to check the impacts of this change on other tests and I don't have a patch against 1.34 as I'm currently testing against 1.33.1 due to the SourceForge CVS problems. Cheers, Nicola Musatti
participants (2)
-
Nicola Musatti
-
Robert Ramey