关于glibc中的函数宣言
关于glibc中的函数声明
今天看glibc的源代码有很多的函数声明是这种格式的
后面加了个 __THROW是啥意思啊,不太懂
------解决方案--------------------
在c++调用的情况下,会在函数声明后加入 throw()
表明该函数不会扔出异常,这样避免编译器生成对异常的
处理代码,优化生成结果.
今天看glibc的源代码有很多的函数声明是这种格式的
extern int semctl (int __semid, int __semnum, int __cmd, ...) __THROW;
后面加了个 __THROW是啥意思啊,不太懂
------解决方案--------------------
# if defined __cplusplus && (__GNUC__ >;= 3
------解决方案--------------------
__GNUC_MINOR__ >;=
# define __THROW throw ()
# else
# define __THROW
# endif
在c++调用的情况下,会在函数声明后加入 throw()
表明该函数不会扔出异常,这样避免编译器生成对异常的
处理代码,优化生成结果.