Main MRPT website > C++ reference
MRPT logo
compiler_fixes.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 
29 #ifndef UTILSDEFS_H
30 #error "This file is intended for include from utils_defs.h only!"
31 #endif
32 
33 /* ------------------------------------
34  Disable some warnings
35  ------------------------------------ */
36 #if defined(_MSC_VER)
37  #pragma warning(disable:4786) // (Compiler: Visual C++) Disable warning for too long debug names:
38  #pragma warning(disable:4503) // (Compiler: Visual C++ 2010) Disable warning for too long decorated name
39  #pragma warning(disable:4702) // (Compiler: Visual C++) Disable warning for unreachable code (I don't know why some of these errors appear in the STANDARD LIBRARY headers with Visual Studio 2003!):
40  #pragma warning(disable:4244) // (Compiler: Visual C++) Conversion double->float
41  #pragma warning(disable:4305)
42  #pragma warning(disable:4308) // Disable warning for Eigen3 libs: negative integral converted to unsigned
43  #pragma warning(disable:4267)
44  #pragma warning(disable:4290) // Visual C++ does not implement decl. specifiers: throw(A,B,...)
45  #pragma warning(disable:4251) // Visual C++ 2003+ warnings on STL classes when exporting to DLL...
46  #pragma warning(disable:4275)
47  #pragma warning(disable:4308) // Disable for Eigen: negative integral constant converted to unsigned int
48  #if (_MSC_VER >= 1400 )
49  // MS believes they have the right to deprecate functions in the C++ Standard STL... disable their warnings:
50  #ifndef _SCL_SECURE_NO_WARNINGS
51  #define _SCL_SECURE_NO_WARNINGS
52  #endif
53  //#pragma warning(disable:4996) // Deprecated functions
54  // For the new secure library in VC++8
55  #if !defined(_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES)
56  #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
57  #endif
58  #endif
59 #endif
60 
61 // Avoid conflicting declaration of max macro in windows headers
62 #include <algorithm>
63 #if defined(MRPT_OS_WINDOWS) && !defined(NOMINMAX)
64 # define NOMINMAX
65 # ifdef max
66 # undef max
67 # undef min
68 # endif
69 #endif
70 
71 // We want to avoid defining "max" & "min" as #define's since it create conflicts
72 // with methods, variables, etc... with the same name in some compilers.
73 // Use std::max & std::min for all compilers by default, but for MSVC6 it does not exist:
74 #if defined(_MSC_VER) && (_MSC_VER<1300)
75 # ifndef max
76  namespace std
77  {
78  template<class T> inline const T max(const T& A,const T& B) { return A>B ? A:B; }
79  template<class T> inline const T min(const T& A,const T& B) { return A<B ? A:B; }
80  }
81 # else
82 # define MAX3_MSVC6_VERSION
83 # endif
84 #endif
85 
86 // Min & Max:
87 #ifndef MAX3_MSVC6_VERSION
88  template<typename T> inline const T min3(const T& A, const T& B,const T& C) { return std::min<T>(A, std::min<T>(B,C) ); }
89  template<typename T> inline const T max3(const T& A, const T& B,const T& C) { return std::max<T>(A, std::max<T>(B,C) ); }
90 #else
91 # define max3(A,B,C) max(A,max(B,C))
92 # define min3(A,B,C) min(A,min(B,C))
93 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013