[svn] commit: r2672 - in /trunk/src/lib/bench: benchmark.h tests/benchmark_unittest.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Aug 9 21:46:09 UTC 2010


Author: jinmei
Date: Mon Aug  9 21:46:09 2010
New Revision: 2672

Log:
changed the type of class constants from double to int so that they can be
initialized as part of the class definition.  we should rely on implicit type
conversion in this case so this change should be safe.

quite trivial so committing it to trunk directly, but I'll note it on the ML.

Modified:
    trunk/src/lib/bench/benchmark.h
    trunk/src/lib/bench/tests/benchmark_unittest.cc

Modified: trunk/src/lib/bench/benchmark.h
==============================================================================
--- trunk/src/lib/bench/benchmark.h (original)
+++ trunk/src/lib/bench/benchmark.h Mon Aug  9 21:46:09 2010
@@ -349,11 +349,19 @@
     }
 public:
     /// \brief A constant that indicates a failure in \c getAverageTime().
-    static const double TIME_FAILURE = -1;
+    ///
+    /// This constant be used as double but is defined as int so that it can
+    /// be initialized within the class definition.  Type conversion will be
+    /// performed implicitly.
+    static const int TIME_FAILURE = -1;
 
     /// \brief A constant that indicates a failure in
     /// \c getIterationPerSecond().
-    static const double ITERATION_FAILURE = -1;
+    ///
+    /// This constant be used as double but is defined as int so that it can
+    /// be initialized within the class definition.  Type conversion will be
+    /// performed implicitly.
+    static const int ITERATION_FAILURE = -1;
 private:
     void initialize(const bool immediate) {
         if (immediate) {

Modified: trunk/src/lib/bench/tests/benchmark_unittest.cc
==============================================================================
--- trunk/src/lib/bench/tests/benchmark_unittest.cc (original)
+++ trunk/src/lib/bench/tests/benchmark_unittest.cc Mon Aug  9 21:46:09 2010
@@ -60,7 +60,7 @@
 // XXX: some compilers cannot find class static constants used in
 // EXPECT_xxx macross, for which we need an explicit definition.
 template <typename T>
-const double BenchMark<T>::TIME_FAILURE;
+const int BenchMark<T>::TIME_FAILURE;
 }
 }
 




More information about the bind10-changes mailing list