C中的Noreturn函数说明符
_Noreturn函数说明符用于告知编译器该函数将不返回任何内容。如果程序内部使用了return语句,则编译器将生成编译时错误。
范例程式码
#include<stdio.h>
main() {
printf("The returned value: %d\n", function);
}
char function() {
return 'T'; //return T as character
}输出结果
The program terminates abnormally [Warning] function declared 'noreturn' has a 'return' statement
现在,如果它是正常功能,它将可以正常工作。
范例程式码
#include<stdio.h>
int function() {
return 86; //try to return a value
}
main() {
printf("The returned value: %d\n", function());
}输出结果
The returned value: 86
热门推荐
10 祝孙辈生日祝福语简短
11 恋人跨年祝福语大全简短
12 考大学敬酒简短祝福语
13 开工投产大吉祝福语 简短
14 偶然结婚祝福语朋友简短
15 感谢学长学姐祝福语简短
16 戏精的祝福语简短
17 我要结婚祝福语简短
18 婚前女儿生日祝福语简短