exit和return
来源:互联网 发布:威露士滴露哪个好 知乎 编辑:程序博客网 时间:2024/05/17 23:38
Terminate calling process
Terminates the process normally, performing the regular cleanup for terminating programs.Normal program termination performs the following (in the same order):
- Objects associated with the current thread with thread storage duration are destroyed (C++11 only).
- Objects with static storage duration are destroyed (C++) and functions registered with atexit are called.
- All C streams (open with functions in <cstdio>) are closed (and flushed, if buffered), and all files created with tmpfile are removed.
- Control is returned to the host environment.
Note that objects with automatic storage are not destroyed by calling exit (C++).
If status is zero or EXIT_SUCCESS, a successful termination status is returned to the host environment.
If status is EXIT_FAILURE, an unsuccessful termination status is returned to the host environment.
Otherwise, the status returned depends on the system and library implementation.
exit()和return的区别:
按照ANSI C,在最初调用的main()中使用return和exit()的效果相同。
但要注意这里所说的是“最初调用”。如果main()在一个递归程序中,exit()仍然会终止程序;但return将
控制权移交给递归的前一级,直到最初的那一级,此时return才会终止程序。return和exit()的另一个区别
在于,即使在除main()之外的函数中调用exit(),它也将终止程序。
阅读全文
1 0
- return 和exit
- exit和return区别
- exit和return
- exit和return
- exit()和return
- 关于exit() 和 return ()
- exit和return区别
- return 和 exit
- exit 和 return
- return和exit
- return和exit
- return和exit()
- exit和return
- Exit()和return
- exit()和_exit()和return
- Exit() 和 Return() 的区别
- exit函数和return函数
- exit()和return小析
- 鼠标右键添加快捷方式
- 一个简单的异步操作
- Ubuntu安装FlatBuffers
- 条码规范——Code 39
- ML for trading -cs7646-02
- exit和return
- Struts2拦截器精解
- 转载的开源干货
- 设计模式-观察者模式
- 【怎样写代码】函数式编程 -- Lambda表达式(二):C#常用委托
- top命令详解
- Android 7.1 源码编译
- PriorityQueue 优先级队列【java】
- 条码规范——Code 93