From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/error%2Ferrno_macros.html | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 devdocs/c/error%2Ferrno_macros.html (limited to 'devdocs/c/error%2Ferrno_macros.html') 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 @@ +

Error numbers

Each of the macros defined in <errno.h> expands to an integer constant expression with type int 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 'E' followed by digits or uppercase letters.

+ + + + +
Defined in header <errno.h>
EDOM
Mathematics argument out of domain of function
(macro constant)
EILSEQ
+
(C95)
Illegal byte sequence
(macro constant)
ERANGE
Result too large
(macro constant)

Notes

Many additional errno constants are defined by POSIX and by the C++ standard library, and individual implementations may define even more, e.g. errno(3) on Linux or intro(2) on BSD and OS X.

+

Example

#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));
+}

Possible output:

+
log(-1.0) = nan
+Numerical argument out of domain
+ 
+log(0.0)  = -inf
+Numerical result out of range

References

See also

+ + + +
macro which expands to POSIX-compatible thread-local error number variable
(macro variable)
displays a character string corresponding of the current error to stderr
(function)
+
(C11)(C11)
returns a text version of a given error code
(function)
C++ documentation for Error numbers
+

+ © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ https://en.cppreference.com/w/c/error/errno_macros +

+
-- cgit v1.2.3