Remove MS CRT memory management debugging

Redefining new breaks perfectly valid code, but only on MSVC and only in
one particular configuration (Debug). This is very annoying because it
means people not using MSVC, or even people doing Release builds, can
write standards-conforming code which then may fail to build for other
people.
directional-lights
Nicolas Hake 2016-07-21 19:43:34 +02:00
parent f7a04624eb
commit a188500609
4 changed files with 0 additions and 26 deletions

View File

@ -66,23 +66,6 @@ don't need to include this file or any of the files it includes. */
#include <regex>
namespace re = std;
// debug memory management - must come after standard headers,
// because those libraries use placement new
#ifndef NODEBUGMEM
#if defined(_DEBUG) && defined(_MSC_VER)
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
inline void *operator new(size_t s, const char *szFile, long iLine)
{ return ::operator new(s, _NORMAL_BLOCK, szFile, iLine); }
inline void operator delete(void *p, const char *, long)
{ ::operator delete(p); }
#define new_orig new
#define new new(__FILE__, __LINE__)
#endif
#endif
#include <new>
#include "lib/Standard.h"
#include "C4Prototypes.h"
#include "lib/C4Real.h"

View File

@ -18,10 +18,7 @@
#include "platform/StdScheduler.h"
#pragma push_macro("new")
#undef new
#include <pcg/pcg_random.hpp>
#pragma pop_macro("new")
#ifndef INC_C4Particles
#define INC_C4Particles

View File

@ -23,10 +23,7 @@
#include <random>
#pragma push_macro("new")
#undef new
#include <pcg/pcg_random.hpp>
#pragma pop_macro("new")
int RandomCount = 0;

View File

@ -21,8 +21,6 @@
#define INC_STANDARD
#include <type_traits>
#pragma push_macro("new")
#undef new
// The Clear/Default functions that exist on most OpenClonk classes are A
// BAD IDEA because the caller has no guarantee that every member has been
@ -39,7 +37,6 @@ inline InplaceReconstruct(T *obj)
obj->~T();
new (obj) T();
}
#pragma pop_macro("new")
#include "platform/PlatformAbstraction.h"