文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > C标准库源码解剖(9):控制函数assert.h, setjmp.h和signal.h
侵权投诉

C标准库源码解剖(9):控制函数assert.h, setjmp.h和signal.h

C标准库源码解剖(9)

5. #include <stdlib.h>

6. #

C标准库源码解剖(9):控制函数assert.h, setjmp.h和signal.h

include <sysdep.h>

7. #include <unistd.h>

8.

9. extern const char *__progname;

10. #ifdef USE_IN_LIBIO

11. # include <wchar.h>

12. # include <libio/iolibio.h>

13. # define fflush(s) INTUSE(_IO_fflush) (s)

14. #endif

15. /* 本函数当传递一个包含断言表达式的字符串、一个文件名、和一个行号时,在

标准

16. 错误流上用以下格式打印一条消息:

17. a.c:10: foobar: Assertion `a == b' failed.

18. 然后通过调用abort来终止程序的执行 */

19. #ifdef FATAL_PREPARE_INCLUDE

20. # include FATAL_PREPARE_INCLUDE

21. #endif

22. #undef __assert_fail

23. void

24. __assert_fail (const char *assertion, const char *file, unsigned int line,

25. const char *function)

26. {

27. char *buf;

28. #ifdef FATAL_PREPARE

29. FATAL_PREPARE;

30. #endif

31. /* 把指定格式的消息写入到buf中 */

32. if (__asprintf (&buf, _("%s%s%s:%u: %s%sAssertion `%s' failed./n"),

33. __progname, __progname[0] ? ": " : "",

34. file, line,

35. function ? function : "", function ? ": " : "",

36. assertion) >= 0)

37. {

38. (void) __fxprintf (NULL, "%s", buf); /* 打印buf中的消息 */

上一页第4页

TOP相关主题

你可能喜欢

热门文档

相关文档

  • c标准库

    c标准库<assert.h>:诊断 <assert.h>中只定义了...<ctype.h>中定义的标准函数列 表如下: <ctype.h...Longjmp with value 1 一般地, setjmp 和 longjmp ...

  • C语言函数库

    c 语言函数库 第一章(C 标准库) 1. 2. 3. ...10 1. <assert.h>:诊断 <assert.h>中只定义了...Longjmp with value 1 一般地, setjmp 和 longjmp ...

  • C标准库函数集

    诊断<assert.h>......信号处理<signal.h>......C 标准库函数,但没有列出一些用途有限的函数以及某些可以简单的从其 他函数合成的函数,也没有包含多字节和...

  • 附录二 C语言标准库

    标准语言概述函数库简介 C语言标准库的历史 标准库...在C89标准中: <assert.h> <ctype.h> <errno.h...setjmp.h signal.h 嵌入式家园 www.embedclub.com...

  • 第1篇 标准库介绍

    表 9-1 标准库函数 <assert.h> <ctype.h> <...<signal.h> <stdarg.h> <stddef.h> <stdio.h...<setjmp.h>中定义了两个宏: int setjmp(jmp_buf...

  • c语言函数库-第一章(C标准库)

    c语言函数库-第一章(C标准库)_IT/计算机_专业...10 1. <assert.h>:诊断 : <assert.h>中只定义...Longjmp with value 1 一般地, setjmp 和 longjmp ...

  • C标准库函数集(头文件索引)

    C标准库函数集(头文件索引)_IT/计算机_专业资料...诊断<assert.h>......8.1 setjmp #include <setjmp.h> int setjmp(jmp_buf env); setjmp()宏把...

  • c标准库文库

    <assert.h>:诊断 <assert.h>中只定义了一个带参...<setjmp.h>中定义了两个宏: int setjmp(jmp_buf...在<signal.h>中只定义了两个函数: int signal(...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email