VERIFY Macro

Syntax

VERIFY( booleanExpression );

Parameters

exp

An expression (including pointer values) that evaluates to TRUE or FALSE.

Remarks

In the Debug version of the Microsoft Foundation Class Library, the VERIFY macro evaluates its argument. If the result is FALSE, the macro prints a diagnostic message and halts 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 version of the Microsoft Foundation Class Library, VERIFY evaluates the expression but does not print or interrupt the program. For example, if the expression is a function call, the call will be made.

Example

CFile f;

VERIFY( f.Open( "file.dat", CFile::modeCreate | CFile::modeWrite ) );

// Terminates program if Open fails; always executes Open

See Also

ASSERT