ASSERTMSG (Windows CE 5.0)

Send Feedback

This macro asserts an expression, and if that expression is FALSE, it prints a debugging message to NKDbgPrintfW and produces a DebugBreak.

#defineASSERTMSG(message,Condition)

Parameters

  • Message
    Formatted debugging message.
  • Condition
    Boolean value used to determine whether DEBUGMSG and DEBUGCHK are invoked.

Return Values

None.

Remarks

This macro may be used to check the value of a Boolean expression and produce a formatted text message, as well as generating a DebugBreak if the expression evaluates FALSE.

If the expression evaluates to FALSE, this code will print your failure message and then DebugBreak to allow you to examine the situation in a debugger. This macro also prints a debug message with the file name and line number where the assertion failed.

Call this macro to validate invariants in your code. For example:

 ASSERTMSG(TEXT("Invalid number of items"),
           dwCurrentNumberOfItems < dwMaxNumberOfItems);

Will print output like this:

 Invalid number of items
 Unknown: DEBUGCHK failed in file C:\WINCE500\Programs\MyProgram\.\main.c at line 34

This macro is only present in Debug builds; it does nothing on Retail and ship builds.

To evaluate an assertion without printing an additional message, use ASSERT.

Requirements

OS Versions: Windows CE OS 2.10 and later
Header: Dbgapi.h
Link Library: none

See Also

ASSERT | DEBUGMSG | DebugBreak

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.