As values may be used uninitialised, they have now been given

sensible defaults; or, in other words, if worse comes to worst,
we'll get a guaranteed segfault rather than a heisenburg.
This commit is contained in:
Andrew Coles 2009-03-23 21:15:33 +00:00
parent 70c0174bf9
commit 64fbd93cd9

View File

@ -163,8 +163,8 @@ typename Minimizer::Scalar ei_minimize_helper(const BVH &tree, Minimizer &minimi
typedef typename BVH::Index Index; typedef typename BVH::Index Index;
typedef std::pair<Scalar, Index> QueueElement; //first element is priority typedef std::pair<Scalar, Index> QueueElement; //first element is priority
typename BVH::VolumeIterator vBegin, vEnd; typename BVH::VolumeIterator vBegin = 0, vEnd = 0;
typename BVH::ObjectIterator oBegin, oEnd; typename BVH::ObjectIterator oBegin = 0, oEnd = 0;
std::priority_queue<QueueElement, std::vector<QueueElement>, std::greater<QueueElement> > todo; //smallest is at the top std::priority_queue<QueueElement, std::vector<QueueElement>, std::greater<QueueElement> > todo; //smallest is at the top
todo.push(std::make_pair(Scalar(), root)); todo.push(std::make_pair(Scalar(), root));
@ -230,10 +230,10 @@ typename Minimizer::Scalar BVMinimize(const BVH1 &tree1, const BVH2 &tree2, Mini
typedef ei_minimizer_helper2<typename BVH2::Volume, typename BVH2::Object, typename BVH1::Object, Minimizer> Helper2; typedef ei_minimizer_helper2<typename BVH2::Volume, typename BVH2::Object, typename BVH1::Object, Minimizer> Helper2;
typedef std::pair<Scalar, std::pair<Index1, Index2> > QueueElement; //first element is priority typedef std::pair<Scalar, std::pair<Index1, Index2> > QueueElement; //first element is priority
typename BVH1::VolumeIterator vBegin1, vEnd1; typename BVH1::VolumeIterator vBegin1, vEnd1 = 0;
typename BVH1::ObjectIterator oBegin1, oEnd1; typename BVH1::ObjectIterator oBegin1 = 0, oEnd1 = 0;
typename BVH2::VolumeIterator vBegin2, vEnd2, vCur2; typename BVH2::VolumeIterator vBegin2, vEnd2 = 0, vCur2;
typename BVH2::ObjectIterator oBegin2, oEnd2, oCur2; typename BVH2::ObjectIterator oBegin2 = 0, oEnd2 = 0, oCur2;
std::priority_queue<QueueElement, std::vector<QueueElement>, std::greater<QueueElement> > todo; //smallest is at the top std::priority_queue<QueueElement, std::vector<QueueElement>, std::greater<QueueElement> > todo; //smallest is at the top
Scalar minimum = std::numeric_limits<Scalar>::max(); Scalar minimum = std::numeric_limits<Scalar>::max();