Boost logo

Ublas :

From: Angus Leeming (angus.leeming_at_[hidden])
Date: 2005-10-24 06:29:15


Hi, Michael.

compiling some code with 'g++ -DNDEBUG -O2 -W -Wall', I'm getting a
couple of warnings about unused variables:

boost/numeric/ublas/vector.hpp:721: warning: unused parameter 'it'
boost/numeric/ublas/functional.hpp:1390: warning: unused parameter
'size1'

Looking at the code, it is clear that the human reader is clever than
the compiler here, because it is perfectly obvious that the variable
is used after all, albeit only in debug mode. Stupid compilers :)

Here's a patch that modifies the code like so:

+#include <boost/concept_check.hpp>

    // Comparison
    BOOST_UBLAS_INLINE
    bool operator == (const const_iterator &it) const {
        BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());
+ boost::ignore_unused_variable_warning(it);
        return true;
    }

(It also replaces a few TAB characters that appear to have slipped
in ;)

Regards,
Angus