I am attempting to get Memory leak detection working with the help of these two articles:
http://msdn.microsoft.com/en-us/library/e5ewb1h3%28VS.80%29.aspx
http://support.microsoft.com/kb/q140858/
So in my stdafx.h I now have:
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define new new(_NORMAL_BLOCK,__FILE__,__LINE__)
The only problem is, I have a class which overrides the new function:
class Dummy
{
//overloaded new operator
void FAR* operator new(size_t cb);
}
Now when I compile this code, I get:
error C2059: syntax error : ‘constant’
error C2091: function returns function
Any idea how I can fix this?
You can use pragma directives to save and restore the new macro when undefing for overloads. See [MSDN](http://msdn.microsoft.com/en-us/library/hsttss76(VS.71).aspx) for the exact syntax.
E.g.
You can put these in headers, e.g.
begin_new_override.h:
end_new_override.h:
And then