[mlpack-git] master: Fix -Wunintialized, reported by govg. (6d60e7c)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 22:03:23 EST 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

>---------------------------------------------------------------

commit 6d60e7c14f0ee5c7e1a843721da459ab01ffade9
Author: Ryan Curtin <ryan at ratml.org>
Date:   Tue Nov 18 20:46:28 2014 +0000

    Fix -Wunintialized, reported by govg.


>---------------------------------------------------------------

6d60e7c14f0ee5c7e1a843721da459ab01ffade9
 src/mlpack/methods/det/dtree.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 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);



More information about the mlpack-git mailing list