In MFC you ussualy use classes derived from CObject. When you have a pointer to an object of such kind of class you want to be sure that this pointer is valid. This works only in DEBUG version.
E.g.:
Code:
void function(CWnd* pWnd)
{
ASSERT_VALID(pWnd);
}
The CWnd class is derived from CObject. The following checks are done:
- pointer must be not NULL
- the address pointed must be valid at least a number of sizeof(CObject) bytes. This is useful when the pointer is used not initialised (e.g. the value is 0xcdcdcdcd)
- the virtual table pointer should be valid
- calls AssertValid member function of that object to make specific check. You should overwrite this virtual function and call the base version. Add here your specific check.
If any of these operations fails, a DebugBreak() is raised.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.