Ok I found a way to pass the arguments in the delete operator by a global variables like this:#define DELETE_OLD delete #define delete 0; while(bIsDeleteParamsPassing); bIsDeleteParamsPassing=true; chFile=(char*)__FILE__; inLineNo=__LINE__; DELETE_OLD
#define DBG_DELETE delete(__FILE__, __LINE__) #define delete DBG_DELETE
If you want some reasoning why I say the above code is bad, all you have to do is look at bIsDeleteParamsPassing... is that supposed to be some kind of mutex? You realize it doesn't work to protect your code in a multithreaded environment, right? I'm also unsure of why the 0; is there...
And just a few more critiques on your code:
- Be consistent with the std namespace. Sometimes you just say size_t instead of std::size_t. You should always use the fully qualified std:: prefix in header files (and also in source files, unless you do using namespace std).
- If you're going to use global variables (which you shouldn't be), put them in a namespace
- Be consistent in your type names. Sometimes you use unsigned int, sometimes UINT
- Consider using proper types for booleans (i.e. use false instead of 0 when assigning to a bool)