[mlpack-svn] r17377 - mlpack/trunk/src/mlpack/methods/det

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Nov 18 15:46:28 EST 2014


Author: rcurtin
Date: Tue Nov 18 15:46:28 2014
New Revision: 17377

Log:
Fix -Wunintialized, reported by govg.


Modified:
   mlpack/trunk/src/mlpack/methods/det/dtree.cpp

Modified: mlpack/trunk/src/mlpack/methods/det/dtree.cpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/det/dtree.cpp	(original)
+++ mlpack/trunk/src/mlpack/methods/det/dtree.cpp	Tue Nov 18 15:46:28 2014
@@ -158,9 +158,9 @@
     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 @@
   }
 }
 
-// Return string of object. 
+// Return string of object.
 std::string DTree::ToString() const
 {
   std::ostringstream convert;



More information about the mlpack-svn mailing list