atexit
来自cppreference.com
|
|
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
| 在头文件 <stdlib.h> 中定义
|
||
| int atexit( void (*func)() ); |
||
注册所指向的函数被称为正常的程序终止
func(通过exit(),或从main()返回).原文:
Registers the function pointed to by
func to be called on normal program termination (via exit() or returning from main()).从多个线程中调用的函数不会导致数据争用。的实施应支持至少32功能的注册.
原文:
Calling the function from several threads does not induce a data race. The implementation shall support the registration of at least 32 functions.
目录 |
[编辑] 参数
| func | - | 指针到函数的调用,正常的程序终止
原文: pointer to a function to be called on normal program termination |
[编辑] 返回值
0如果注册成功,非零值,否则.....
原文:
0 if the registration succeeds, nonzero value otherwise.
[编辑] 例外
[编辑] 示例
输出:
pushed second pushed first
[编辑] 另请参阅
| (C99) |
注册一个函数使其在调用quick_exit时被调用 (函数) |
| C++ documentation for atexit
| |