diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/c/error%2Ferrno_macros.html | |
new repository
Diffstat (limited to 'devdocs/c/error%2Ferrno_macros.html')
| -rw-r--r-- | devdocs/c/error%2Ferrno_macros.html | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/devdocs/c/error%2Ferrno_macros.html b/devdocs/c/error%2Ferrno_macros.html new file mode 100644 index 00000000..5ecee98f --- /dev/null +++ b/devdocs/c/error%2Ferrno_macros.html @@ -0,0 +1,44 @@ + <h1 id="firstHeading" class="firstHeading">Error numbers</h1> <p>Each of the macros defined in <code><errno.h></code> expands to an integer constant expression with type <code>int</code> and with a unique positive value. The following constants are defined by ISO C. The implementation may define more, as long as they begin with <code>'E'</code> followed by digits or uppercase letters.</p> +<table class="t-dsc-begin"> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><errno.h></code> </th> +</tr> <tr class="t-dsc"> <td> <div><span class="t-lines"><span>EDOM</span></span></div> </td> <td> Mathematics argument out of domain of function <br> <span class="t-mark">(macro constant)</span> </td> +</tr> <tr class="t-dsc"> <td> <div><span class="t-lines"><span>EILSEQ</span></span></div> +<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span></span></div> </td> <td> Illegal byte sequence <br> <span class="t-mark">(macro constant)</span> </td> +</tr> <tr class="t-dsc"> <td> <div><span class="t-lines"><span>ERANGE</span></span></div> </td> <td> Result too large <br> <span class="t-mark">(macro constant)</span> </td> +</tr> </table> <h3 id="Notes"> Notes</h3> <p>Many additional errno constants are <a rel="nofollow" class="external text" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html">defined by POSIX</a> and by the <a href="https://en.cppreference.com/w/cpp/error/errno_macros" title="cpp/error/errno macros">C++ standard library</a>, and individual implementations may define even more, e.g. <code>errno(3)</code> on Linux or <code>intro(2)</code> on BSD and OS X.</p> +<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include <stdio.h> +#include <math.h> +#include <errno.h> +#include <string.h> + +int main(void) +{ + errno = 0; + printf("log(-1.0) = %f\n", log(-1.0)); + printf("%s\n\n",strerror(errno)); + + errno = 0; + printf("log(0.0) = %f\n", log(0.0)); + printf("%s\n",strerror(errno)); +}</pre></div> <p>Possible output:</p> +<div class="text source-text"><pre data-language="c">log(-1.0) = nan +Numerical argument out of domain + +log(0.0) = -inf +Numerical result out of range</pre></div> </div> <h3 id="References"> References</h3> <ul> +<li> C11 standard (ISO/IEC 9899:2011): </li> +<ul><li> 7.5/2 Errors <errno.h> (p: 205) </li></ul> +<li> C99 standard (ISO/IEC 9899:1999): </li> +<ul><li> 7.5/2 Errors <errno.h> (p: 186) </li></ul> +<li> C89/C90 standard (ISO/IEC 9899:1990): </li> +<ul><li> 4.1.3 Errors <errno.h> </li></ul> +</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="errno" title="c/error/errno"> <span class="t-lines"><span>errno</span></span></a></div> </td> <td> macro which expands to POSIX-compatible thread-local error number variable<br><span class="t-mark">(macro variable)</span> </td> +</tr> <tr class="t-dsc"> <td> <div><a href="../io/perror" title="c/io/perror"> <span class="t-lines"><span>perror</span></span></a></div> </td> <td> displays a character string corresponding of the current error to <code><a href="../io/std_streams" title="c/io/std streams">stderr</a></code> <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td> <div><a href="../string/byte/strerror" title="c/string/byte/strerror"> <span class="t-lines"><span>strerror</span><span>strerror_s</span><span>strerrorlen_s</span></span></a></div> +<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> returns a text version of a given error code <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/error/errno_macros" title="cpp/error/errno macros">C++ documentation</a></span> for <span class=""><span>Error numbers</span></span> </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/error/errno_macros" class="_attribution-link">https://en.cppreference.com/w/c/error/errno_macros</a> + </p> +</div> |
