c – 在extern C中使用_attribute __((nothrow))是否有意义?
发布时间:2020-12-16 06:52:25 所属栏目:百科 来源:网络整理
导读:我从C调用了一些C代码. 标题类似于以下内容: #ifndef CLibH#define CLibH#ifdef __cplusplusextern "C" {#endif//C APIvoid foo(void);// ...#ifdef __cplusplus}#endif#endif 由于我已经在使用extern C, 添加nothrow编译器属性有什么好处? #ifndef CLibH#
我从C调用了一些C代码.
标题类似于以下内容: #ifndef CLibH #define CLibH #ifdef __cplusplus extern "C" { #endif //C API void foo(void); // ... #ifdef __cplusplus } #endif #endif 由于我已经在使用extern C, #ifndef CLibH #define CLibH #ifdef __cplusplus extern "C" { #endif //C API void foo(void) __attribute__((nothrow)); // ... #ifdef __cplusplus } #endif #endif 外部C会使这个多余吗? 解决方法
是的,它确实.来自gcc文档:
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |