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://mrpt.sourceforge.net/                            |
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                 #define _SCL_SECURE_NO_WARNINGS
00049                 #pragma warning(disable:4996)
00050                 // For the new secure library in VC++8
00051                 #if !defined(_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES)
00052                         #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
00053                 #endif
00054         #endif
00055 #endif
00056 
00057 // Avoid conflicting declaration of max macro in windows headers
00058 #if defined(MRPT_OS_WINDOWS) && !defined(NOMINMAX)
00059 #       define NOMINMAX
00060 #       ifdef max
00061 #               undef   max
00062 #               undef   min
00063 #       endif
00064 #endif
00065 
00066 //  We want to avoid defining "max" & "min" as #define's since it create conflicts
00067 //    with methods, variables, etc... with the same name in some compilers.
00068 // Use std::max & std::min for all compilers by default, but for MSVC6 it does not exist:
00069 #if defined(_MSC_VER) && (_MSC_VER<1300)
00070 #       ifndef max
00071                 namespace std
00072                 {
00073                         template<class T> inline const T max(const T& A,const T& B) { return A>B ? A:B; }
00074                         template<class T> inline const T min(const T& A,const T& B) { return A<B ? A:B; }
00075                 }
00076 #       else
00077 #               define  MAX3_MSVC6_VERSION
00078 #       endif
00079 #endif
00080 
00081 // Min & Max:
00082 #ifndef MAX3_MSVC6_VERSION
00083         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) ); }
00084         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) ); }
00085 #else
00086 #       define max3(A,B,C) max(A,max(B,C))
00087 #       define min3(A,B,C) min(A,min(B,C))
00088 #endif
00089 
00090 // Enable leak memory debugging:
00091 #if defined(_DEBUG) && defined(_MSC_VER) && (_MSC_VER>=1400)
00092         #define _CRTDBG_MAP_ALLOC
00093         #include <stdlib.h>
00094         #include <crtdbg.h>
00095 #endif
00096 



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:40:17 UTC 2011