代碼聲明如下:
#if __cplusplus & MEMORY_TRACE_FLAG & MEMORY_TRACE_OPERATOR
void* operator new( long unsigned int nSize, const char* pFile, const char* pFunction, const int nLine);
void* operator new []( long unsigned int nSize, const char* pFile, const char* pFunction, const int nLine);
void operator delete( void* p, const char* pFile, const char* pFunction, const int nLine);
void operator delete [](void* p, const char* pFile, const char* pFunction, const int nLine);
#endif
宏定義(其他的頭檔案):
#define new new( __FILE__, __FUNCTION__, __LINE__)
#define delete delete(__FILE__, __FUNCTION__, __LINE__)
奇怪的事情出現了:
new可以正确執行.
delete根本就編譯不過.這是為什麼?
錯誤是:
error: type ‘int’ argument given to ‘delete’, expected pointer
#define delete delete(__FILE__, __FUNCTION__, __LINE__)
^
../gh-manager/gh_camera.h:56:17: note: in expansion of macro ‘delete’
delete pConfigure;