Browse Source

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.


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@2672 e5f2f494-b856-4b98-b285-d166d9295462

JINMEI Tatuya 14 years ago
parent
commit
4e77358148
2 changed files with 11 additions and 3 deletions
  1. 10 2
      src/lib/bench/benchmark.h
  2. 1 1
      src/lib/bench/tests/benchmark_unittest.cc

+ 10 - 2
src/lib/bench/benchmark.h

@@ -349,11 +349,19 @@ public:
     }
 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) {

+ 1 - 1
src/lib/bench/tests/benchmark_unittest.cc

@@ -60,7 +60,7 @@ BenchMark<TestBenchMark>::tearDown() {
 // 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;
 }
 }