Condividi tramite


VERIFY

Nella versione di debug di MFC, restituisce il relativo argomento.

VERIFY(booleanExpression )

Parametri

  • booleanExpression
    Specifica un'espressione (valori di puntatore inclusi) che restituisce un valore diverso da zero o 0.

Note

Se il risultato è 0, la macro stampa un messaggio di diagnostica e interrompe il programma.Se la condizione è diversa da zero, non esegue alcuna operazione.

Il messaggio diagnostico presenta il formato

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

dove nome è il nome del file di origine e num è il numero di riga dell'asserzione che non riuscire nel file di origine.

Nella versione finale di MFC, VERIFICA valuta l'espressione ma non stampa o non interrompe il programma.Ad esempio, se l'espressione è una chiamata di funzione, la chiamata viene eseguita.

Esempio

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

Requisiti

Header: afx.h

Vedere anche

Riferimenti

ASSERT (MFC)

Concetti

Macro MFC e Globals