std::exit
来自cppreference.com
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <cstdlib> 中定义
|
||
[[noreturn]] void exit( int exit_code ); |
(C++11 起) | |
void exit( int exit_code ); |
(至 C++11) | |
导致正常的程序终止发生.
原文:
Causes normal program termination to occur.
若干清理步骤被执行:
- 具有静态存储持续时间的对象的析构函数被调用原文:destructors of objects with static storage duration are called
- 功能传递给std::atexit被调用。如果有异常传播的任何功能,被称为std::terminate原文:functions passed to std::atexit are called. If an exception tries to propagate out of any of the function, std::terminate is called
- 刷新并关闭所有的C流
- std::tmpfile所创建的文件将被删除原文:files created by std::tmpfile are removed
- 控制被返回到主机环境。如果
exit_code
是EXIT_SUCCESS,实现自定义的状态,表示成功终止。如果exit_code
是EXIT_FAILURE,实现自定义的状态,表示成功终止。在其他情况下实现自定义的状态值,则返回.原文:control is returned to the host environment. Ifexit_code
is EXIT_SUCCESS, an implementation-defined status, indicating successful termination is returned. Ifexit_code
is EXIT_FAILURE, an implementation-defined status, indicating unsuccessful termination is returned. In other cases implementation-defined status value is returned.
目录 |
[编辑] 参数
exit_code | - | 退出的程序的状态
|
[编辑] 返回值
(无)
[编辑] 示例
本章尚未完成 原因:暂无示例 |
[编辑] 另请参阅
导致程序异常终止(不清洗) 原文: causes abnormal program termination (without cleaning up) (函数) | |
注册exit()调用一个函数被调用 原文: registers a function to be called on exit() invocation (函数) | |
(C++11) |
没有完全清理,会导致正常的程序终止 原文: causes normal program termination without completely cleaning up (函数) |
C documentation for exit
|