...
| Wiki Markup |
|---|
\[[ISO/IEC PDTR 24772|AA. References#ISOBibliography#ISO/IEC PDTR 24772]\] Section 6.47, "REU Termination strategy," says: |
...
| Wiki Markup |
|---|
C99, Section 5.1.2.2.3, has this to say about returning from {{main()}} \[[ISO/IEC 9899:1999|AA. References#ISOBibliography#ISO/IEC 9899-1999]\]: |
If the return type of the
mainfunction is a type compatible withint, a return from the initial call to themainfunction is equivalent to calling theexitfunction with the value returned by themainfunction as its argument; reaching the}that terminates themainfunction returns a value of 0. If the return type is not compatible withint, the termination status returned to the host environment is unspecified.
...
| Wiki Markup |
|---|
<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="34a27f215ac2aece-d4fa06cf-4fdd4589-835aad49-1f7f2df66f454ee11561ce6d"><ac:parameter ac:name="">1</ac:parameter></ac:structured-macro>\[1\] Note that POSIX ^®^ strengthens the specification for {{_Exit()}} by prohibiting the function from flushing stream buffers. See the {{[documentation|http://www.opengroup.org/onlinepubs/9699919799/functions/_Exit.html]}} of the function in \[[IEEE Std 1003.1-2008|AA. References#IEEEBibliography#IEEE Std 1003.1-2008]\]. |
| Code Block | ||
|---|---|---|
| ||
#include <stdlib.h>
/* ... */
if (/* something really bad happened */) {
_Exit(EXIT_FAILURE);
}
|
...
| Wiki Markup |
|---|
<ac:structured-macro ac:name="anchor" ac:schema-version="1" ac:macro-id="3aab020e3b06eab0-cf24293d-4b3b40fb-9b669dba-5bd7856cbf128e15b4a2e8c2"><ac:parameter ac:name="">2</ac:parameter></ac:structured-macro>\[2\] Unlike in the case of {{\_Exit()}}, POSIX ^®^ explicitly permits but does not require implementations to flush stream buffers. See the {{[documentation|http://www.opengroup.org/onlinepubs/9699919799/functions/abort.html]}} of the function in \[[IEEE Std 1003.1-2008|AA. References#IEEEBibliography#IEEE Std 1003.1-2008]\]. |
Summary
...
| Wiki Markup |
|---|
\[[ISO/IEC 9899:1999|AA. References#ISOBibliography#ISO/IEC 9899-1999]\] Section 5.1.2.2.3, "Program termination," and Section 7.20.4, "Communication with the environment" \[[ISO/IEC PDTR 24772|AA. References#ISOBibliography#ISO/IEC PDTR 24772]\] "REU Termination strategy" \[[MITRE 07|AA. References#MITREBibliography#MITRE 07]\] [CWE ID 705|http://cwe.mitre.org/data/definitions/705.html], "Incorrect Control Flow Scoping" |
...