[mlpack-git] master: Attempt 2: avoid min/max definitions. (8bd3f96)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Fri Mar 20 09:14:29 EDT 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/a12065450b76493f4cef2a68d5a1abcf60745ecd...8bd3f964748695df1023ea6a74b9e5d4bae75eb4

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

commit 8bd3f964748695df1023ea6a74b9e5d4bae75eb4
Author: Ryan Curtin <ryan at ratml.org>
Date:   Fri Mar 20 09:13:59 2015 -0400

    Attempt 2: avoid min/max definitions.


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

8bd3f964748695df1023ea6a74b9e5d4bae75eb4
 src/mlpack/core/util/timers.hpp |  8 ++++++--
 src/mlpack/prereqs.hpp          | 13 -------------
 2 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/src/mlpack/core/util/timers.hpp b/src/mlpack/core/util/timers.hpp
index f52f4a8..19fc786 100644
--- a/src/mlpack/core/util/timers.hpp
+++ b/src/mlpack/core/util/timers.hpp
@@ -24,10 +24,14 @@
   #include <sys/time.h>   // timeval, gettimeofday()
   #include <unistd.h>     // flags like  _POSIX_VERSION
 #elif defined(_WIN32)
-  #include <windows.h>  //GetSystemTimeAsFileTime(),
+  #ifndef NOMINMAX
+    #define NOMINMAX // Don't define min and max macros.
+  #endif
+  #include <windows.h>  // GetSystemTimeAsFileTime(),
                         // QueryPerformanceFrequency(),
                         // QueryPerformanceCounter()
-  #include <winsock.h>  //timeval on windows
+  #include <winsock.h>  // timeval on windows
+  #undef NOMINMAX
 
   // uint64_t isn't defined on every windows.
   #if !defined(HAVE_UINT64_T)
diff --git a/src/mlpack/prereqs.hpp b/src/mlpack/prereqs.hpp
index fb00259..66c8ec8 100644
--- a/src/mlpack/prereqs.hpp
+++ b/src/mlpack/prereqs.hpp
@@ -3,19 +3,6 @@
  *
  * The core includes that mlpack expects; standard C++ includes and Armadillo.
  */
-
-// Clean up unfortunate Windows preprocessor definitions, even if this file was
-// already included.  Use std::min and std::max!
-#ifdef _WIN32
-  #ifdef min
-    #undef min
-  #endif
-
-  #ifdef max
-    #undef max
-  #endif
-#endif
-
 #ifndef __MLPACK_PREREQS_HPP
 #define __MLPACK_PREREQS_HPP
 



More information about the mlpack-git mailing list