-
"Non-function" error
The following code:
Code:
inline void * __cdecl operator new(unsigned int size,
const char *file, int line)
{
void *ptr = (void *)malloc(size);
AddTrack((DWORD)ptr, size, file, line);
return(ptr);
};
gives me
Code:
error: declaration of `operator new' as non-function
Why?
-
Okay, I managed to eliminate that problem by commenting out the following in a header file (yes, if you haven't noticed, I'm using the example code from this):
Code:
#define DEBUG_NEW new(__FILE__, __LINE__)
#define new DEBUG_NEW
BUT I want to be able to #include this file and have it override the new operator with that macro to make it spew out some diagnostics. How do I do that?
-
Problem solved by sticking the function definitions above the macro.