代码声明如下:
#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;