Partilhar via


DEBUG_ONLY

No modo de depuração (quando o símbolo de _DEBUG é definido), DEBUG_ONLY avalia o argumento.

DEBUG_ONLY(expression )

Comentários

Em uma compilação de versão, DEBUG_ONLY não avalia o argumento. Isso é útil quando você tiver código que deve ser executado somente em construções de depuração.

A macro de DEBUG_ONLY é equivalente a expressão circunvizinha com #ifdef _DEBUG e #endif.

Exemplo

void ExampleFunc(char* p, int size, char fill)
{
   char* q;               // working copy of pointer 
   VERIFY(q = p);         // copy buffer pointer and validate
   ASSERT(size >= 100);   // make sure buffer is at least 100 bytes
   ASSERT(isalpha(fill)); // make sure fill character is alphabetic 
   // if fill character is invalid, substitute 'X' so we can continue 
   // debugging after the preceding ASSERT fails.
   DEBUG_ONLY(fill = (isalpha(fill)) ? fill : 'X');
}

Requisitos

Header: afx.h

Consulte também

Referência

ASSERT (MFC)

VERIFY

Conceitos

Macros e globais MFC