[mlpack] 99/149: Fix -Wunintialized, reported by govg.

Barak A. Pearlmutter barak+git at pearlmutter.net
Sat May 2 09:11:13 UTC 2015


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch svn-trunk
in repository mlpack.

commit ce1ef3488e1ec05a2053c0b062232886e9473780
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Tue Nov 18 20:46:28 2014 +0000

    Fix -Wunintialized, reported by govg.
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@17377 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/methods/det/dtree.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mlpack/methods/det/dtree.cpp b/src/mlpack/methods/det/dtree.cpp
index a91c513..476a5b4 100644
--- a/src/mlpack/methods/det/dtree.cpp
+++ b/src/mlpack/methods/det/dtree.cpp
@@ -158,9 +158,9 @@ bool DTree::FindSplit(const arma::mat& data,
     bool dimSplitFound = false;
     // Take an error estimate for this dimension.
     double minDimError = std::pow(points, 2.0) / (max - min);
-    double dimLeftError;
-    double dimRightError;
-    double dimSplitValue;
+    double dimLeftError = 0.0; // For -Wuninitialized.  These variables will
+    double dimRightError = 0.0; // always be set to something else before use.
+    double dimSplitValue = 0.0;
 
     // Find the log volume of all the other dimensions.
     double volumeWithoutDim = logVolume - std::log(max - min);
@@ -661,7 +661,7 @@ void DTree::ComputeVariableImportance(arma::vec& importances) const
   }
 }
 
-// Return string of object. 
+// Return string of object.
 std::string DTree::ToString() const
 {
   std::ostringstream convert;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list