Udostępnij za pośrednictwem


VERIFY

W wersji Debug MFC ocenia jej argumentów.

VERIFY(booleanExpression )

Parametry

  • booleanExpression
    Określa (w tym wartości wskaźnika) wyrażenie ma wartość różną od zera lub równa zero.

Uwagi

Jeśli wynik jest równy 0, makra drukuje komunikat diagnostyczny i zatrzymuje program.Jeśli warunek jest różna od zera, to nic nie robi.

Komunikat diagnostyczny ma postać

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

gdzie Nazwa jest nazwą pliku źródłowego i num jest numer wiersza twierdzenie, że nie powiodło się w pliku źródłowym.

W wersji programu MFC Sprawdź oblicza wyrażenie nie drukować lub przerwać program.Na przykład jeśli wyrażenie jest wywołanie funkcji, wywołanie zostanie wykonane.

Przykład

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

Wymagania

Nagłówek: afx.h

Zobacz też

Informacje

ASSERT (MFC)

Koncepcje

Makra i funkcje globalne MFC