global.hpp

Go to the documentation of this file.
00001 /* $Id: global.hpp 23842 2008-02-16 08:47:16Z mordante $ */
00002 /*
00003    Copyright (C) 2003 - 2008 by David White <dave@whitevine.net>
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License version 2
00008    or at your option any later version.
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY.
00011 
00012    See the COPYING file for more details.
00013 */
00014 
00015 #ifndef DISABLE_4786_HPP_INCLUDED
00016 #define DISABLE_4786_HPP_INCLUDED
00017 
00018 //for windows compilers
00019 #ifdef __MSVCRT__
00020 #ifndef __GNUC__
00021     #undef snprintf
00022     #define snprintf _snprintf
00023 #endif
00024 #endif
00025 
00026 #ifdef _MSC_VER
00027 
00028 #undef snprintf
00029 #define snprintf _snprintf
00030 
00031 //disable the warning to let us know about 'this' being used in
00032 //initializer list, since it's a common thing to want to do
00033 //for callbacks, and there is no other way to easily workaround the warning
00034 #pragma warning(disable:4355)
00035 
00036 //disable the warnings for long template names
00037 #pragma warning(disable:4503)
00038 #pragma warning(disable:4786)
00039 
00040 //the following code causes the incredibly irritating warning 4786 to really
00041 //be muted in Visual C++ 6. No-one seems to know *why* it works (possibly not even Microsoft)
00042 //but it does. So don't ask, and just leave it there.
00043 
00044 class warning4786WorkAround {
00045 public:
00046 warning4786WorkAround() {}
00047 };
00048 
00049 static warning4786WorkAround VariableThatHacksWarning4786IntoBeingMutedForSomeUnknownReason;
00050 
00051 //put the mathematical functions where they belong: in the std namespace
00052 //it is necessary for VC6 at least
00053 #include <cmath>
00054 namespace std {
00055   using ::floor;
00056   using ::sqrt;
00057   using ::ceil;
00058   using ::fmod;
00059   using ::pow;
00060 }
00061 
00062 //put the FILE where it belongs: in the std namespace
00063 #include <cstdio>
00064 namespace std {
00065   using ::FILE;
00066   using ::fclose;
00067 }
00068 
00069 //put the Locale functions where they belong: in the std namespace
00070 #include <clocale>
00071 namespace std {
00072  using ::setlocale;
00073 }
00074 
00075 //put the string functions where they belong: in the std namespace
00076 #include <cstring>
00077 namespace std {
00078   using ::strrchr;
00079 }
00080 
00081 #endif
00082 #endif

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs