Main MRPT website > C++ reference
MRPT logo
compiler_fixes.h
Go to the documentation of this file.
00001 /* +---------------------------------------------------------------------------+
00002    |          The Mobile Robot Programming Toolkit (MRPT) C++ library          |
00003    |                                                                           |
00004    |                       http://www.mrpt.org/                                |
00005    |                                                                           |
00006    |   Copyright (C) 2005-2011  University of Malaga                           |
00007    |                                                                           |
00008    |    This software was written by the Machine Perception and Intelligent    |
00009    |      Robotics Lab, University of Malaga (Spain).                          |
00010    |    Contact: Jose-Luis Blanco  <jlblanco@ctima.uma.es>                     |
00011    |                                                                           |
00012    |  This file is part of the MRPT project.                                   |
00013    |                                                                           |
00014    |     MRPT is free software: you can redistribute it and/or modify          |
00015    |     it under the terms of the GNU General Public License as published by  |
00016    |     the Free Software Foundation, either version 3 of the License, or     |
00017    |     (at your option) any later version.                                   |
00018    |                                                                           |
00019    |   MRPT is distributed in the hope that it will be useful,                 |
00020    |     but WITHOUT ANY WARRANTY; without even the implied warranty of        |
00021    |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         |
00022    |     GNU General Public License for more details.                          |
00023    |                                                                           |
00024    |     You should have received a copy of the GNU General Public License     |
00025    |     along with MRPT.  If not, see <http://www.gnu.org/licenses/>.         |
00026    |                                                                           |
00027    +---------------------------------------------------------------------------+ */
00028 
00029 #ifndef UTILSDEFS_H
00030 #error "This file is intended for include from utils_defs.h only!"
00031 #endif
00032 
00033 /* ------------------------------------
00034           Disable some warnings
00035    ------------------------------------ */
00036 #if defined(_MSC_VER)
00037         #pragma warning(disable:4786) // (Compiler: Visual C++) Disable warning for too long debug names:
00038         #pragma warning(disable:4503) // (Compiler: Visual C++ 2010) Disable warning for too long decorated name
00039         #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!):
00040         #pragma warning(disable:4244) // (Compiler: Visual C++) Conversion double->float
00041         #pragma warning(disable:4305)
00042         #pragma warning(disable:4267)
00043         #pragma warning(disable:4290) // Visual C++ does not implement decl. specifiers: throw(A,B,...)
00044         #pragma warning(disable:4251) // Visual C++ 2003+ warnings on STL classes when exporting to DLL...
00045         #pragma warning(disable:4275)
00046         #if (_MSC_VER >= 1400 )
00047                 // MS believes they have the right to deprecate functions in the C++ Standard STL... disable their warnings:
00048                 #ifndef _SCL_SECURE_NO_WARNINGS
00049                         #define _SCL_SECURE_NO_WARNINGS
00050                 #endif
00051                 #pragma warning(disable:4996)
00052                 // For the new secure library in VC++8
00053                 #if !defined(_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES)
00054                         #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
00055                 #endif
00056         #endif
00057 #endif
00058 
00059 // Avoid conflicting declaration of max macro in windows headers
00060 #if defined(MRPT_OS_WINDOWS) && !defined(NOMINMAX)
00061 #       define NOMINMAX
00062 #       ifdef max
00063 #               undef   max
00064 #               undef   min
00065 #       endif
00066 #endif
00067 
00068 //  We want to avoid defining "max" & "min" as #define's since it create conflicts
00069 //    with methods, variables, etc... with the same name in some compilers.
00070 // Use std::max & std::min for all compilers by default, but for MSVC6 it does not exist:
00071 #if defined(_MSC_VER) && (_MSC_VER<1300)
00072 #       ifndef max
00073                 namespace std
00074                 {
00075                         template<class T> inline const T max(const T& A,const T& B) { return A>B ? A:B; }
00076                         template<class T> inline const T min(const T& A,const T& B) { return A<B ? A:B; }
00077                 }
00078 #       else
00079 #               define  MAX3_MSVC6_VERSION
00080 #       endif
00081 #endif
00082 
00083 // Min & Max:
00084 #ifndef MAX3_MSVC6_VERSION
00085         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) ); }
00086         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) ); }
00087 #else
00088 #       define max3(A,B,C) max(A,max(B,C))
00089 #       define min3(A,B,C) min(A,min(B,C))
00090 #endif
00091 
00092 // Enable leak memory debugging:
00093 #if defined(_DEBUG) && defined(_MSC_VER) && (_MSC_VER>=1400)
00094         #define _CRTDBG_MAP_ALLOC
00095         #include <stdlib.h>
00096         #include <crtdbg.h>
00097 #endif
00098 



Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011