Boost logo

Ublas :

Subject: Re: [ublas] assignment.hpp woes
From: Nasos Iliopoulos (nasos_i_at_[hidden])
Date: 2011-10-11 13:47:39


Fred,

Can you please confirm that this patch works? I will make a upload to
the trac if it does.

I couldn't reproduce the missing prototypes warning (gcc 4.6.1)

Best,
Nasos

On 10/11/2011 12:29 PM, Frédéric Devernay wrote:
> Hi,
>
> I started using ublas's "<<=" assignment, and I'm starting to regret it.
> First symptom: if I compile with the gcc flag -Wmissing-prototypes I get the following warnings:
>
> In file included from /Users/devernay/Development/stereocam/surf/CameraMatrixP.hpp:16,
> from /Users/devernay/Development/stereocam/surf/TriFocalTensor/Trifocaltensor.hpp:18,
> from /Users/devernay/Development/stereocam/surf/TriFocalTensor/TrifocaltensorBundleAdjustement.cpp:20:
> /opt/local/include/boost/numeric/ublas/assignment.hpp:454: warning: no previous prototype for 'boost::numeric::ublas::begin1_manip boost::numeric::ublas::begin1()'
> /opt/local/include/boost/numeric/ublas/assignment.hpp:498: warning: no previous prototype for 'boost::numeric::ublas::begin2_manip boost::numeric::ublas::begin2()'
> /opt/local/include/boost/numeric/ublas/assignment.hpp:543: warning: no previous prototype for 'boost::numeric::ublas::next_row_manip boost::numeric::ublas::next_row()'
> /opt/local/include/boost/numeric/ublas/assignment.hpp:587: warning: no previous prototype for 'boost::numeric::ublas::next_column_manip boost::numeric::ublas::next_column()'
> /opt/local/include/boost/numeric/ublas/assignment.hpp:888: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_row_policy<boost::numeric::ublas::traverse_policy::wrap> boost::numeric::ublas::traverse_policy::by_row()'
> /opt/local/include/boost/numeric/ublas/assignment.hpp:892: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_row_policy<boost::numeric::ublas::traverse_policy::wrap> boost::numeric::ublas::traverse_policy::by_row_wrap()'
> /opt/local/include/boost/numeric/ublas/assignment.hpp:896: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_row_policy<boost::numeric::ublas::traverse_policy::no_wrap> boost::numeric::ublas::traverse_policy::by_row_no_wrap()'
> /opt/local/include/boost/numeric/ublas/assignment.hpp:900: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_column_policy<boost::numeric::ublas::traverse_policy::wrap> boost::numeric::ublas::traverse_policy::by_column()'
> /opt/local/include/boost/numeric/ublas/assignment.hpp:904: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_column_policy<boost::numeric::ublas::traverse_policy::wrap> boost::numeric::ublas::traverse_policy::by_column_wrap()'
> /opt/local/include/boost/numeric/ublas/assignment.hpp:908: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_column_policy<boost::numeric::ublas::traverse_policy::no_wrap> boost::numeric::ublas::traverse_policy::by_column_no_wrap()'
>
> But the second symptom is more critical: Since these symbols are defined in EVERY file that includes them, I cannot link anything and I get tons of "multiply defined symbols".
>
> Looking at the file, I found out that:
> - begin1(), begin2(), and a few others are not inlined, but conditionally inlined, using BOOST_UBLAS_INLINE (which inlines only if NDEBUG is defined), and are NOT members of classes, thus the multiply defined symbols...
> - boost::numeric::ublas::traverse_policy::by_row() and other are just defined, and not inlined.
>
> So, really, what's the solution?
> Here's what I think:
>
> BOOST_UBLAS_INLINE should ONY be used for class members, NOT for functions, which should be simply declared "inline".
>
> by_row() and friends should either be inlined or declared as static members of an empty class.
>
> I tried putting the magic word "inline" in front of each of these, and it works.
>
> fred
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: athanasios.iliopoulos.ctr.gr_at_[hidden]