diff options
Diffstat (limited to 'devdocs/c/program%2Fquick_exit.html')
| -rw-r--r-- | devdocs/c/program%2Fquick_exit.html | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/devdocs/c/program%2Fquick_exit.html b/devdocs/c/program%2Fquick_exit.html new file mode 100644 index 00000000..2527ca17 --- /dev/null +++ b/devdocs/c/program%2Fquick_exit.html @@ -0,0 +1,52 @@ + <h1 id="firstHeading" class="firstHeading">quick_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-c11 t-until-c23"> <td><pre data-language="c">_Noreturn void quick_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 quick_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> are called in reverse order of their registration. After calling the registered functions, calls <code><a href="http://en.cppreference.com/w/c/program/_Exit"><span class="kw489">_Exit</span></a><span class="br0">(</span>exit_code<span class="br0">)</span></code>.</p> +<p>Functions passed to <code><a href="atexit" title="c/program/atexit">atexit</a></code> or signal handlers passed to <code><a href="signal" title="c/program/signal">signal</a></code> are not called.</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> + +void f1(void) +{ + puts("pushed first"); + fflush(stdout); +} + +void f2(void) +{ + puts("pushed second"); +} + +void f3(void) +{ + puts("won't be called"); +} + +int main(void) +{ + at_quick_exit(f1); + at_quick_exit(f2); + atexit(f3); + quick_exit(0); +}</pre></div> <p>Output:</p> +<div class="text source-text"><pre data-language="c">pushed second +pushed first</pre></div> </div> <h3 id="References"> References</h3> <ul> +<li> C17 standard (ISO/IEC 9899:2018): </li> +<ul><li> 7.22.4.7 The quick_exit function (p: 257) </li></ul> +<li> C11 standard (ISO/IEC 9899:2011): </li> +<ul><li> 7.22.4.7 The quick_exit function (p: 353) </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="atexit" title="c/program/atexit"> <span class="t-lines"><span>atexit</span></span></a></div> </td> <td> registers a function to be called on <code><a href="exit" title="c/program/exit">exit()</a></code> invocation <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td> <div><a href="at_quick_exit" title="c/program/at quick exit"> <span class="t-lines"><span>at_quick_exit</span></span></a></div> +<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> registers a function to be called on <strong class="selflink"><code>quick_exit</code></strong> invocation <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/quick_exit" title="cpp/utility/program/quick exit">C++ documentation</a></span> for <code>quick_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/quick_exit" class="_attribution-link">https://en.cppreference.com/w/c/program/quick_exit</a> + </p> +</div> |
