lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] patch to avoid MSVC warning about comparing bools with doubles


From: Vadim Zeitlin
Subject: [lmi] patch to avoid MSVC warning about comparing bools with doubles
Date: Sat, 25 Jul 2009 17:03:20 +0200

 Hello,

 While rebuilding LMI to test the print preview issues discussed in the
other message I got a new MSVC warning in mec_view.cpp where boolean fields
are passed to the function "f" which compares them with
std::numeric_limits<double>::max(). The warning is harmless here, of
course, but this comparison is still unnecessary, as both bools and also
ints can never compare equally to this value anyhow so, instead of just
suppressing the warning I'd like to propose the patch below which restricts
this comparison to doubles only.

 What do you think?
VZ

--- mec_view.cpp        2009-07-25 14:39:43 +0000
+++ mec_view.cpp        2009-07-25 14:57:49 +0000
@@ -36,7 +36,7 @@
 #include "data_directory.hpp"
 #include "database.hpp"
 #include "dbnames.hpp"
-#include "et_vector.hpp"
+#include "tools/pete-2.1.1/et_vector.hpp"
 #include "handle_exceptions.hpp"
 #include "ihs_commfns.hpp"
 #include "ihs_irc7702a.hpp"
@@ -245,9 +245,15 @@

 namespace
 {
+
 template<typename T>
 std::string f(T t)
 {
+    return "&nbsp;&nbsp;&nbsp;" + value_cast<std::string>(t);
+}
+
+std::string f(double t)
+{
     static double const bignum = std::numeric_limits<double>::max();
     if(bignum == t)
         {
@@ -258,6 +264,7 @@
         return "&nbsp;&nbsp;&nbsp;" + value_cast<std::string>(t);
         }
 }
+
 } // Unnamed namespace.

 void mec_view::Run()


reply via email to

[Prev in Thread] Current Thread [Next in Thread]