
Many, many warnings of the following type (g++ 3.2)... /home/jody/boost_1_32_0/libs/serialization/src/basic_iarchive.cpp: In member function `bool boost::archive::detail::basic_iarchive_impl::track(boost::archive::deta il::basic_iarchive&, void*&)': /home/jody/boost_1_32_0/libs/serialization/src/basic_iarchive.cpp:291: warning: choosing `boost::archive::object_id_type::operator unsigned int&()' over ` boost::archive::object_id_type::operator unsigned int() const' /home/jody/boost_1_32_0/libs/serialization/src/basic_iarchive.cpp:291: warning: for conversion from `boost::archive::object_id_type' to `unsigned int' /home/jody/boost_1_32_0/libs/serialization/src/basic_iarchive.cpp:291: warning: because conversion sequence for the argument is better /home/jody/boost_1_32_0/libs/serialization/src/basic_iarchive.cpp: In member function `void boost::archive::detail::basic_iarchive_impl::load_object(boost::archive ::detail::basic_iarchive&, void*, const boost::archive::detail::basic_iserializer&)':

I've never really understood this warning - basically it reminds me that I did what I intended to do. Robert Rame "Jody Hagins" <jody-boost-011304@atdesk.com> wrote in message news:20041122143539.0ccc5574.jody-boost-011304@atdesk.com...
Many, many warnings of the following type (g++ 3.2)...
/home/jody/boost_1_32_0/libs/serialization/src/basic_iarchive.cpp: In member function `bool
boost::archive::detail::basic_iarchive_impl::track(boost::archive::deta il::basic_iarchive&, void*&)': /home/jody/boost_1_32_0/libs/serialization/src/basic_iarchive.cpp:291: warning: choosing `boost::archive::object_id_type::operator unsigned int&()' over ` boost::archive::object_id_type::operator unsigned int() const' /home/jody/boost_1_32_0/libs/serialization/src/basic_iarchive.cpp:291: warning: for conversion from `boost::archive::object_id_type' to `unsigned int' /home/jody/boost_1_32_0/libs/serialization/src/basic_iarchive.cpp:291: warning: because conversion sequence for the argument is better /home/jody/boost_1_32_0/libs/serialization/src/basic_iarchive.cpp: In member function `void
boost::archive::detail::basic_iarchive_impl::load_object(boost::archive ::detail::basic_iarchive&, void*, const boost::archive::detail::basic_iserializer&)': _______________________________________________ Unsubscribe & other changes:

On Mon, 22 Nov 2004 12:54:17 -0800 "Robert Ramey" <ramey@rrsd.com> wrote:
I've never really understood this warning - basically it reminds me that I did what I intended to do.
Are you always sure? bool basic_iarchive_impl::track( basic_iarchive & ar, void * & t ){ object_id_type oid; load(ar, oid); // if its a reference to a old object if(object_id_type(object_id_vector.size()) > oid){ // we're done t = object_id_vector[oid].address; return false; } return true; } object_id_vector is a std::vector<>, so it has... reference operator[](size_type n), where size_type is "unsigned int" The line that generates the warning wants to convert a "object_id_type" to a "unsigned int" so it can pass the index to operator[](). However, object_id_type is a class (BOOST_STRONG_DEF) with the following conversion operators... operator T () const {return t; } \ operator T & () { return t; } \ where T is "unsigned int" So, in the attempt to convert from object_id_type to "unsigned int", we try both of the operators, and they both match. So, the compiler can not decide which one you want, because your object is non-const. Maybe in this situation, it does not matter, but there are many situations in which this multiple match can cause harm. So, I think the warnings should be eliminated, to prevent a piece of "bad" use from being overlooked because we get used to seeing these warnings. The presence of both operators in the BOOST_STRONG_DEF is what causes this ambiguity...

This came about when I had to make changes to accomodate borland compilers which didn't like the BOOST_STRONG_TYPEDEF code. I think I originally wanted "Jody Hagins" <jody-boost-011304@atdesk.com> wrote in message news:20041122165456.34f46069.jody-boost-011304@atdesk.com...
On Mon, 22 Nov 2004 12:54:17 -0800 "Robert Ramey" <ramey@rrsd.com> wrote:
I've never really understood this warning - basically it reminds me that I did what I intended to do.
Are you always sure?
bool basic_iarchive_impl::track( basic_iarchive & ar, void * & t ){ object_id_type oid; load(ar, oid);
// if its a reference to a old object if(object_id_type(object_id_vector.size()) > oid){ // we're done t = object_id_vector[oid].address; return false; } return true; }
object_id_vector is a std::vector<>, so it has...
reference operator[](size_type n), where size_type is "unsigned int"
The line that generates the warning wants to convert a "object_id_type" to a "unsigned int" so it can pass the index to operator[]().
However, object_id_type is a class (BOOST_STRONG_DEF) with the following conversion operators...
operator T () const {return t; } \ operator T & () { return t; } \
where T is "unsigned int"
So, in the attempt to convert from object_id_type to "unsigned int", we try both of the operators, and they both match. So, the compiler can not decide which one you want, because your object is non-const. Maybe in this situation, it does not matter, but there are many situations in which this multiple match can cause harm.
So, I think the warnings should be eliminated, to prevent a piece of "bad" use from being overlooked because we get used to seeing these warnings.
The presence of both operators in the BOOST_STRONG_DEF is what causes this ambiguity...
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

This came about when I made some tweaks to get it to pass borland compilers. I think my original intention was operator const T () const {return t; } \ operator T & () { return t; } \ but maybe some compiler or other complained when T was a primitive type. Honestly I don't remember now. I think that only a couple of compilers warn about this. Robert Ramey "Jody Hagins" <jody-boost-011304@atdesk.com> wrote in message news:20041122165456.34f46069.jody-boost-011304@atdesk.com...
On Mon, 22 Nov 2004 12:54:17 -0800 "Robert Ramey" <ramey@rrsd.com> wrote:
I've never really understood this warning - basically it reminds me that I did what I intended to do.
Are you always sure?
bool basic_iarchive_impl::track( basic_iarchive & ar, void * & t ){ object_id_type oid; load(ar, oid);
// if its a reference to a old object if(object_id_type(object_id_vector.size()) > oid){ // we're done t = object_id_vector[oid].address; return false; } return true; }
object_id_vector is a std::vector<>, so it has...
reference operator[](size_type n), where size_type is "unsigned int"
The line that generates the warning wants to convert a "object_id_type" to a "unsigned int" so it can pass the index to operator[]().
However, object_id_type is a class (BOOST_STRONG_DEF) with the following conversion operators...
operator T () const {return t; } \ operator T & () { return t; } \
where T is "unsigned int"
So, in the attempt to convert from object_id_type to "unsigned int", we try both of the operators, and they both match. So, the compiler can not decide which one you want, because your object is non-const. Maybe in this situation, it does not matter, but there are many situations in which this multiple match can cause harm.
So, I think the warnings should be eliminated, to prevent a piece of "bad" use from being overlooked because we get used to seeing these warnings.
The presence of both operators in the BOOST_STRONG_DEF is what causes this ambiguity...
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Robert Ramey wrote:
This came about when I made some tweaks to get it to pass borland compilers.
I think my original intention was
operator const T () const {return t; } \ operator T & () { return t; } \
but maybe some compiler or other complained when T was a primitive type. Honestly I don't remember now. I think that only a couple of compilers warn about this.
Robert Ramey
Mornin' Older Compaq cxx (Digital C++) compilers have that warning - this one in particular has annoyed me in the past: [michael@anaconda michael]$ cxx -V DIGITAL C++ V6.0-010 on DIGITAL UNIX V4.0 (Rev. 1530) This one, on the ther hand, is fine: [michael@viper michael]$ cxx -V Compaq C++ V6.5-014 for Compaq Tru64 UNIX V5.1B (Rev. 2650) Compiler Driver V6.5-014 (cxx) cxx Driver The DECXX version for the later compiler is 60590014, we identify it as follows: #if defined(__DECCXX) #if (__DECCXX_VER<60590014) // do workaround #endif #endif I don't know in which version between the two this was fixed. Michael
participants (3)
-
Jody Hagins
-
Michael van der Westhuizen
-
Robert Ramey