quick_exit
定义于头文件
<stdlib.h> |
||
_Noreturn void quick_exit( int exit_code );
|
(C11 起) | |
导致程序正常终止,而不完全清理资源。
以注册顺序的逆序调用传递给 at_quick_exit 的函数。调用完注册的函数后,调用 _Exit(exit_code) 。
参数
exit_code | - | 程序的退出状态 |
返回值
(无)
示例
#include <stdlib.h> #include <stdio.h> void f1(void) { puts("pushed first"); fflush(stdout); } void f2(void) { puts("pushed second"); } int main(void) { at_quick_exit(f1); at_quick_exit(f2); quick_exit(0); }
输出:
pushed second pushed first
引用
- C11 标准(ISO/IEC 9899:2011):
-
- 7.22.4.7 The quick_exit function (p: 353)
参阅
引发非正常的程序终止(不清理) (函数) |
|
注册一个要在调用 exit() 时调用的函数 (函数) |
|
(C11)
|
注册要在调用 quick_exit 时调用的函数 (函数) |