Boost logo

Ublas :

From: Angus Leeming (angus.leeming_at_[hidden])
Date: 2005-09-21 05:51:50


The following simple little code produces a warning with current Boost
cvs.

$ g++ --version
g++ (GCC) 4.0.2 20050917 (prerelease) (Debian 4.0.1-8)

$ g++ -I/home/aleem/boost/cvs -DNDEBUG -O2 -W -Wall -c test.C
/home/aleem/boost/cvs/boost/numeric/ublas/storage.hpp: In function
'void make_weights(const Vector&, double, double)':
/home/aleem/boost/cvs/boost/numeric/ublas/storage.hpp:123: warning:
'data' may be used uninitialized in this function

#include <boost/numeric/ublas/vector.hpp>

typedef boost::numeric::ublas::vector<double> Vector;

Vector const jacobi(Vector const & z, int n, double alpha, double
beta);

void make_weights(Vector const & zeros, double const alpha, double
const beta)
{
        Vector::size_type const P = zeros.size();
        Vector weights(P);

        weights = jacobi(zeros, P-1, alpha, beta);
}

The warning is of course silenced by the attached patch.

Regards,
Angus