Microsoft DirectX 8.0

Assert and Breakpoint Macros

The Microsoft® DirectShow® base classes provide several macros that perform asserts or cause breakpoints.

Declaration: Wxdebug.h

MacroDescription
ASSERTEvaluates an expression, and displays a diagnostic message if the expression is FALSE.
DbgAssertAlignedTests whether a pointer is aligned to a specified boundary.
DbgBreakDisplays a message box with the specified string, the name of the source file, and the line number.
EXECUTE_ASSERTEvaluates an expression in debug and retail builds. In debug builds, displays a diagnostic message if the expression is FALSE.
KASSERTEvaluates an expression, and causes a breakpoint exception if the expression is FALSE.
KDbgBreakCauses a breakpoint exception, and logs the specified string.

ASSERT

Assert and Breakpoint Macros

Evaluates an expression, and displays a diagnostic message if the expression is FALSE. Ignored in retail builds.

Syntax

ASSERT(
    cond
);

Parameters

cond
Expression to evaluate.

Remarks

In debug builds, if the expression is FALSE, this macro displays a message box with the text of the expression, the name of the source file, and the line number. The user can ignore the assertion, enter the debugger, or quit the application.

Example

ASSERT(rtStartTime <= rtEndTime);

DbgAssertAligned

Assert and Breakpoint Macros

Tests whether a pointer is aligned to a specified boundary. If not, this macro invokes the ASSERT macro. Ignored in retail builds.

Syntax

DbgAssertAligned(
    ptr,
    alignment
);

Parameters

ptr
Pointer variable.
alignment
Required alignment.

DbgBreak

Assert and Breakpoint Macros

Displays a message box with the specified string, the name of the source file, and the line number. The user can ignore the message, enter the debugger, or quit the application. Ignored in retail builds.

Syntax

DbgBreak(
    strLiteral
);

Parameters

strLiteral
Text string.

Example

DbgBreak("Unrecoverable error occurred.");

EXECUTE_ASSERT

Assert and Breakpoint Macros

Evaluates an expression in debug and retail builds. In debug builds, displays a diagnostic message if the expression is FALSE.

Syntax

EXECUTE_ASSERT(
    cond
);

Parameters

cond
Expression to evaluate.

Remarks

Unlike the ASSERT macro, this macro evaluates the expression in retail builds. In debug builds, if the expression is FALSE, the macro displays a message box with the text of the expression, the name of the source file, and the line number. The user can ignore the assertion, enter the debugger, or quit the application.

KASSERT

Assert and Breakpoint Macros

Evaluates an expression, and causes a breakpoint exception if the expression is FALSE. The text of the expression, the name of the source file, and the line number are logged using the DbgLog macro. Ignored in retail builds.

Syntax

KASSERT(
    cond
);

Parameters

cond
Expression to evaluate.

Remarks

Unlike the ASSERT and EXECUTE_ASSERT macros, this macro does not display a message box prompting the user. In debug builds, if the expression is FALSE, the macro automatically causes a breakpoint exception to occur.

KDbgBreak

Assert and Breakpoint Macros

Causes a breakpoint exception, and logs the specified string using the DbgLog macro. Ignored in retail builds.

Syntax

KDbgBreak(
    strLiteral
);

Parameters

strLiteral
Text string.

Remarks

Unlike the DbgBreak macro, this macro does not display a message box prompting the user. In debug builds, it automatically causes a breakpoint exception to occur.