Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
ASSERT Macro
                                              Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  ASSERT( booleanExpression );
 
  Parameter           Description
 
  <booleanExpression> An expression (including pointer values) that
                      evaluates to TRUE or FALSE.
 
  Remarks
 
  The ASSERT macro evaluates its argument. If the result is FALSE, the
  macro prints a diagnostic message and aborts the program. If the
  condition is TRUE, 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 environment, 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.
 
  Example
 
  CAge* pcage = new CAge( 21 ); // CAge is derived from CObject
  ASSERT( pcage->IsKindOf( RUNTIME_CLASS( CAge ) ) );
  // Terminates program only if pcage is NOT a CAge*
 
 
  See Also
 
  VERIFY
 
 
                                     -♦-