Sie ÜBERPRÜFEN

In der Debugversion von MFC wertet sein Argument aus.

VERIFY(booleanExpression )

Parameter

  • booleanExpression
    Gibt einen Ausdruck Zeigerwerte) bis (einschließlich der Wert ungleich 0 oder 0 ergibt.

Hinweise

Wenn das Ergebnis 0 ist, wird das Makro eine Diagnosemeldung und stellt das Programm ein.Wenn die Bedingung nicht 0 ist, hat sie keine Auswirkungen.

Die Diagnosemeldung hat das Formular

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

wo Name ist, ist der Name der Quelldatei und das numerische die Zeilennummer der Assertion diesen Fehler in der Quelldatei.

In der Releaseversion von MFC wertet den Ausdruck aus, VERIFY jedoch nicht unterbrochen wird oder das Programm.Wenn beispielsweise der Ausdruck ein Funktionsaufruf ist, wird der Aufruf ausgeführt.

Beispiel

// 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);

Anforderungen

Header: afx.h

Siehe auch

Referenz

ASSERT (MFC)

Konzepte

MFC-Makros und -globale Werte