C Standard Library: 6 Diagnostics: <assert.h>
2013-03-21 14:30
387 查看
The assert macro is used to add diagnostics to programs:
void assert(int expression)
If expression is zero when
assert(expression)
is executed, the assert macro will print on stderr a message, such as
Assertion failed: expression, file filename, line nnn
It then calls abort to terminate execution. The source filename and line number come from the
preprocessor macros __FILE__ and __LINE__.
If NDEBUG is defined at the time <assert.h> is included, the assert macro is ignored.
void assert(int expression)
If expression is zero when
assert(expression)
is executed, the assert macro will print on stderr a message, such as
Assertion failed: expression, file filename, line nnn
It then calls abort to terminate execution. The source filename and line number come from the
preprocessor macros __FILE__ and __LINE__.
If NDEBUG is defined at the time <assert.h> is included, the assert macro is ignored.
相关文章推荐
- C Standard Library: 3 String Functions: <string.h>
- C Standard Library:4 Mathematical Functions: <math.h>
- C Standard Library:5 Utility Functions: <stdlib.h>
- C Standard Library: 11 Implementation-defined Limits: <limits.h> and <float.h>
- C Standard Library: 2 Character Class Tests: <ctype.h>
- C Standard Library: 7 Variable Argument Lists: <stdarg.h>
- C Standard Library: 8 Non-local Jumps: <setjmp.h>
- standard c library <string.h>
- C Standard Library: 9 Signals: <signal.h>
- C/C++ standard library -- <cstring>(string.h)
- c++ standard library <numeric> accumulate demo
- C Standard Library: 10 Date and Time Functions: <time.h>
- C Standard Library: 1 Input and Output: <stdio.h>
- c++ standard library 学习笔记-auto_ptr<T> 注意事项
- Activity的启动模式<standard,singleTop,singleTask,singleInstance>(转)
- C标准库学习之<assert.h> ——诊断
- <System.Diagnostics.DebuggerStepThrough()>
- C /C++标准库 - <cassert> (assert.h)
- <cassert>(<assert.h>)头文件之assert函数
- <assert.h> sscanf