VERIFY
In the Debug version of MFC, evaluates its argument.
VERIFY(booleanExpression )
매개 변수
- booleanExpression
Specifies an expression (including pointer values) that evaluates to nonzero or 0.
설명
If the result is 0, the macro prints a diagnostic message and halts the program. If the condition is nonzero, it does nothing.
진단 메시지의 형식은 다음과 같습니다.
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, 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.
예제
// VERIFY can be used for things that should never fail, though
// you may want to make sure you can provide better error recovery
// if the error can actually cause a crash in a production system.
// It _is_ possible that GetDC() may fail, but the out-of-memory
// condition that causes it isn't likely. For a test application,
// this use of VERIFY() is fine. For any production code, this
// usage is dubious.
// get the display device context
HDC hdc;
VERIFY((hdc = ::GetDC(hwnd)) != NULL);
// give the display context back
::ReleaseDC(hwnd, hdc);
요구 사항
Header: afx.h