Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- MINIMAL.H ---
- #ifndef _MINIMAL_H
- #define _MINIMAL_H
- #include <iostream>
- #ifdef _DEBUG
- void* operator new(size_t Size, int Line, const char* File);
- void* operator new[](size_t Size, int Line, const char* File);
- void operator delete(void* ptr, int Line, const char* File);
- void operator delete[](void* ptr, int Line, const char* File);
- #endif
- #ifdef _DEBUG
- #define DEBUG_NEW new(__LINE__,__FILE__)
- #else
- #define DEBUG_NEW new
- #endif
- #endif //_MINIMAL_H
- --- MINIMAL.CPP ---
- #include "Minimal.h"
- #define new DEBUG_NEW
- #ifdef _DEBUG
- void* operator new(size_t Size, int Line, const char* File)
- {
- void* ptr = (void*)malloc(Size);
- if(ptr)
- {
- return ptr;
- };
- };
- void* operator new[](size_t Size, int Line, const char* File)
- {
- void* ptr = (void*)malloc(Size);
- if(ptr)
- {
- return ptr;
- };
- };
- void operator delete(void* ptr, int Line, const char* File)
- {
- if(ptr)
- {
- free(ptr);
- }
- else
- {
- return;
- };
- };
- void operator delete[](void* ptr, int Line, const char* File)
- {
- if(ptr)
- {
- free(ptr);
- }
- else
- {
- return;
- };
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement