我是靠谱客的博主 端庄手套,这篇文章主要介绍__attribute__ ((noreturn))得使用,现在分享给大家,希望可以做个参考。

A few standard library functions, such as abort and exit, cannot return. GCC knows this automatically. Some programs define their own functions that never return. You can declare them noreturn to tell the compiler this fact. For example,


void fatal () __attribute__ ((noreturn));

;

翻译为:一些库函数,本身没有返回值,例如abort()和exit(),在编译的时候,GCC自动按照这个规则编译。而对于自己定义的函数,如果你不想让它有返回值,那么可以使用__attribute__ ((noreturn))

最后

以上就是端庄手套最近收集整理的关于__attribute__ ((noreturn))得使用的全部内容,更多相关__attribute__内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(137)

评论列表共有 0 条评论

立即
投稿
返回
顶部