_THROW 何解?
2016-03-14 14:33
281 查看
在看/usr/include/........中.h头文件对函数接口的定义时,总是能看到在函数结尾加一个_THROW,一时不明白这是什么意思,而且对于有些POSIX和ISO C不承认或未明确的定义的函数不加_THROW,注释中也会特别说明,该函数不会抛THROW,所以查了一下,
这是一个宏定义,是在GNU下的特色。在头文件#include <cdefs.h>中定义:
在C语言下为 __attribute__ ((__nothrow__))而__nothrow__表示该函数不会抛出异常,但是在C++中就会定义为throw(),和C++异常有关。
这是一个宏定义,是在GNU下的特色。在头文件#include <cdefs.h>中定义:
# if !defined __cplusplus && __GNUC_PREREQ (3, 3) # define __THROW __attribute__ ((__nothrow__)) # define __NTH(fct) __attribute__ ((__nothrow__)) fct # else # if defined __cplusplus && __GNUC_PREREQ (2,8) # define __THROW throw () # define __NTH(fct) fct throw () # else # define __THROW # define __NTH(fct) fct # endif # endif
在C语言下为 __attribute__ ((__nothrow__))而__nothrow__表示该函数不会抛出异常,但是在C++中就会定义为throw(),和C++异常有关。
相关文章推荐
- hibernate与mybatis的比较
- hbase shell 常用命令
- 浦发银行梦卡申请经验
- Android分包MultiDex原理详解
- C++ 内存管理
- JSP写入MySQL数据库中出现乱码问题笔记
- freeradius build
- SQLite3命令行窗口常用命令
- 深入浅出 Kubernetes 架构
- Ubuntu上hi3531交叉编译环境arm-hisiv100nptl-linux搭建过程
- mark一个搜索相关技术的博客
- 离别
- Contiki 在STM32 中的移植
- php常见判断
- IIS mime类型 任意类型
- html入门的笔记总结
- MIPI接口LCD屏调试心得
- 基于Flex的裁剪图片功能封装
- 为什么linux驱动要专门有杂项设备呢
- 用JAVA打暴雪星际争霸(1)--搭建开发环境