diff options
Diffstat (limited to 'devdocs/c/program%2F_exit.html')
| -rw-r--r-- | devdocs/c/program%2F_exit.html | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/devdocs/c/program%2F_exit.html b/devdocs/c/program%2F_exit.html new file mode 100644 index 00000000..4fc7cd21 --- /dev/null +++ b/devdocs/c/program%2F_exit.html @@ -0,0 +1,48 @@ + <h1 id="firstHeading" class="firstHeading">_Exit</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code><stdlib.h></code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl t-since-c99 t-until-c11"> <td><pre data-language="c">void _Exit( int exit_code );</pre></td> <td class="t-dcl-nopad"> </td> <td> +<span class="t-mark-rev t-since-c99">(since C99)</span> <br><span class="t-mark-rev t-until-c11">(until C11)</span> +</td> </tr> <tr class="t-dcl t-since-c11 t-until-c23"> <td> <pre data-language="c">_Noreturn void _Exit( int exit_code );</pre> +</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c11">(since C11)</span> <br><span class="t-mark-rev t-until-c23">(until C23)</span> </td> </tr> <tr class="t-dcl t-since-c23"> <td> <pre data-language="c">[[noreturn]] void _Exit( int exit_code );</pre> +</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c23">(since C23)</span> </td> </tr> </table> <p>Causes normal program termination to occur without completely cleaning the resources.</p> +<p>Functions passed to <code><a href="at_quick_exit" title="c/program/at quick exit">at_quick_exit()</a></code> or <code><a href="atexit" title="c/program/atexit">atexit()</a></code> are not called. Whether open streams with unwritten buffered data are flushed, open streams are closed, or temporary files are removed is implementation-defined.</p> +<p>If <code>exit_code</code> is <code>0</code> or <code><a href="exit_status" title="c/program/EXIT status">EXIT_SUCCESS</a></code>, an implementation-defined status indicating successful termination is returned to the host environment. If <code>exit_code</code> is <code><a href="exit_status" title="c/program/EXIT status">EXIT_FAILURE</a></code>, an implementation-defined status, indicating <i>unsuccessful</i> termination, is returned. In other cases an implementation-defined status value is returned.</p> +<h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> exit_code </td> <td> - </td> <td> exit status of the program </td> +</tr> +</table> <h3 id="Return_value"> Return value</h3> <p>(none)</p> +<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include <stdlib.h> +#include <stdio.h> + +/* _Exit does not call functions registered with atexit. */ +void f1(void) +{ + puts("pushed first"); +} + +void f2(void) +{ + puts("pushed second"); +} + +int main(void) +{ + printf("Enter main()\n"); + atexit(f1); + atexit(f2); + fflush(stdout); /* _Exit may not flush unwritten buffered data */ + _Exit(0); +}</pre></div> <p>Output:</p> +<div class="text source-text"><pre data-language="c">Enter main()</pre></div> </div> <h3 id="References"> References</h3> <ul> +<li> C17 standard (ISO/IEC 9899:2018): </li> +<ul><li> 7.22.4.5 The _Exit function (p: 256) </li></ul> +<li> C11 standard (ISO/IEC 9899:2011): </li> +<ul><li> 7.22.4.5 The _Exit function (p: 352) </li></ul> +<li> C99 standard (ISO/IEC 9899:1999): </li> +<ul><li> 7.20.4.4 The _Exit function (p: 316) </li></ul> +</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="abort" title="c/program/abort"> <span class="t-lines"><span>abort</span></span></a></div> </td> <td> causes abnormal program termination (without cleaning up) <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td> <div><a href="exit" title="c/program/exit"> <span class="t-lines"><span>exit</span></span></a></div> </td> <td> causes normal program termination with cleaning up <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/utility/program/_Exit" title="cpp/utility/program/ Exit">C++ documentation</a></span> for <code>_Exit</code> </td> +</tr> </table> <div class="_attribution"> + <p class="_attribution-p"> + © cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br> + <a href="https://en.cppreference.com/w/c/program/_Exit" class="_attribution-link">https://en.cppreference.com/w/c/program/_Exit</a> + </p> +</div> |
