- 论坛徽章:
- 1
|
回复 1# neodreamerus
一个宏定义,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++异常有关。
至于__attribute__的用法,这里有个链接讲的很清楚
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#Function-Attributes
|
|