The ENSURE and VALIDATE preprocessor macros are used in similar fashion to MFC's VERIFY and ASSERT macros respectively but with the following differences (features):
They log error messages when expression is false instead of interrupting execution with message boxes. Both macros call PBLog with location information, log with message type ERROR, and use the default component and context. (Note that messages created with no specified default will be shipped without a protecting message key.)
They allow greater control over when and how they compile away. Both macros operate independently of debug vs. release build settings since it is frequently useful to leave in diagnostic code for non-debug compiles. They are instead disabled by defining the macros PB_DISABLE_ENSURE and/or PB_DISABLE_VALIDATE. This is done manually with the exception that by default PB_DISABLE_VALIDATE is defined for builds where PB_DEBUG_LEVEL is set to level 1.
ENSURE evaluates to a true/false expression so that it can be embedded in if() statements, which is useful because the error logging happens automatically, leaving the true/false handling code to simply deal with the result without having to worry about logging it as well.
Example
//Code goes away when VALIDATE is disabled by defining PB_DISABLE_VALIDATE.
VALIDATE(IsValid());
//Logs "ENSURE(pszString != NULL) == FALSE" as a _PB_ERROR message.
if (ENSURE(pszString != NULL))
HandleHappyString();
else
HandleNULLString();