CException::Delete
CException::Delete
void CException::Delete();
说明:
此函数检查CException对象是否在堆顶建立,如果在堆顶建立,对该对象做删除操作。当删除该CException对象后,使用Delete成员函数删除异常。不要直接使用删除操作,因为CException对象可能是一个全局对象或者是在栈中创建的。
你可以指定当对象被创建时是否应被删除。要了解更多信息,请参阅CException::CException。
如果使用C++“试抓”(try-catch)机制,只需调用Delete。如果使用MFC的TRY和CATCH宏,这些宏会自动调用此成员函数。
MSDN 解释如下:
CException::Delete
void CException::Delete( );
Remarks
This function checks to see if the CException object was created on the heap, and if so, it calls the delete operator on the object. When deleting a CException object, use the Delete member function to delete the exception. Do not use the delete operator directly, because the CException object may be a global object or have been created on the stack.
You can specify whether the object should be deleted when the object is constructed. For more information, see CException::CException.
You only need to call Delete if you are using the C++ try-catch mechanism. If you are using the MFC macros TRY and CATCH, then these macros will automatically call this function.