MSDN《ASSERT macro (Windows)》

原文(翻译及笔记在后面)

ASSERT macro

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

Syntax

C++

void ASSERT(
   BOOL cond
);

Parameters

cond
Expression to evaluate.

Return value

This macro does not return a value.

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.

Examples

ASSERT(rtStartTime <= rtEndTime);

Requirements

Header Wxdebug.h (include Streams.h)

See also

Assert and Breakpoint Macros

翻译及笔记

ASSERT 宏

计算传给 ASSERT 宏的表达式,若表达式的计算结果为FALSE,则显示诊断信息。在软件的发行版中,该宏会被忽略。

语法

C++

void ASSERT(
   BOOL cond
);

参数

cond
需要计算的表达式。

返回值

此宏不返回值。

备注

在调试版中,若表达式的值为FALSE,此宏将显示一个消息框,其中包含原表达式自身、源文件的名称、assert所在行的行号。用户不仅可以手动忽略 ASSERT 宏,还可以通过 ASSERT 宏来进入调试器或退出应用程序。

扫描二维码关注公众号,回复: 4316585 查看本文章

示例

ASSERT(rtStartTime <= rtEndTime);

需求

Header Wxdebug.h (include Streams.h)

请参阅

Assert and Breakpoint Macros


猜你喜欢

转载自blog.csdn.net/Never_Satisfied/article/details/57408174