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

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

C标准库源码解剖(9)

23. 如果定义了NDEBUG

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

,什么也不做。如果没有定义,且ERRNUM为0,则打

印对应于错误码ERRNUM的错误消息,

24. 然后终止程序 */

25. # ifdef __USE_GNU

26. # define assert_perror(errnum) (__ASSERT_VOID_CAST (0))

27. # endif

28. #else /* 没有定义NDEBUG */

29. #ifndef _ASSERT_H_DECLS

30. #define _ASSERT_H_DECLS

31. __BEGIN_DECLS

32. /* 这里打印一条“断言失败”的消息,然后终止程序 */

33. extern void __assert_fail (__const char *__assertion, __const char *__file,

34. unsigned int __line, __const char *__function)

35. __THROW __attribute__ ((__noreturn__));

36. /* 与上面一样,但打印错误码ERRNUM的错误消息 */

37. extern void __assert_perror_fail (int __errnum, __const char *__file,

38. unsigned int __line,

39. __const char *__function)

40. __THROW __attribute__ ((__noreturn__));

41.

42. /* 下面的函数在这里并没有使用,但为了与标准兼容,还是需要提供 */

43. extern void __assert (const char *__assertion, const char *__file, int __line)

44. __THROW __attribute__ ((__noreturn__));

45.

46. __END_DECLS

47. #endif /* Not _ASSERT_H_DECLS */

48. /* 使用上面的函数来定义完整的assert宏 */

49. # define assert(expr) /

50. ((expr) /

51. ? __ASSERT_VOID_CAST (0) /

52. : __assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCT

ION))

53. # ifdef __USE_GNU

54. # define assert_perror(errnum) /

55. (!(errnum) /

上一页第2页

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