Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.


Evaluates its argument.



Specifies an expression (including pointer values) that evaluates to nonzero or 0.

If the result is 0, the macro prints a diagnostic message and aborts the program. If the condition is nonzero, it does nothing.

The diagnostic message has the form

assertion failed in file <name> in line <num>

where name is the name of the source file, and num is the line number of the assertion that failed in the source file.

In the Release version of MFC, ASSERT does not evaluate the expression and thus will not interrupt the program. If the expression must be evaluated regardless of environment, use the VERIFY macro in place of ASSERT.


This function is available only in the Debug version of MFC.

CAge* pcage = new CAge(21); // CAge is derived from CObject.
ASSERT(pcage != NULL);
// Terminates program only if pcage is NOT a CAge*.   

Header: afx.h

Community Additions

© 2015 Microsoft