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.html | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 devdocs/c/error.html (limited to 'devdocs/c/error.html') diff --git a/devdocs/c/error.html b/devdocs/c/error.html new file mode 100644 index 00000000..935abf5e --- /dev/null +++ b/devdocs/c/error.html @@ -0,0 +1,78 @@ +

Error handling

Error numbers

+ + +
Defined in header <errno.h>
macro which expands to POSIX-compatible thread-local error number variable
(macro variable)
macros for standard POSIX-compatible error conditions
(macro constant)

Assertions

+ + +
Defined in header <assert.h>
aborts the program if the user-specified condition is not true. May be disabled for release builds
(function macro)
+
(C11)(removed in C23)
issues a compile-time diagnostic if the value of a constant expression is false
(keyword macro)
+ +

Bounds checking

The standard library provides bounds-checked versions of some existing functions (gets_s, fopen_s, printf_s, strcpy_s, wcscpy_s, mbstowcs_s, qsort_s, getenv_s, etc). This functionality is optional and is only available if __STDC_LIB_EXT1__ is defined. The following macros and functions support this functionality.

+ + + + + + + + + + + + + + + + +
Defined in header <errno.h>
Defined in header <stdio.h>
errno_t
+
(C11)
a typedef for the type int, used to self-document functions that return errno values
(typedef)
Defined in header <stddef.h>
Defined in header <stdio.h>
Defined in header <stdlib.h>
Defined in header <string.h>
Defined in header <time.h>
Defined in header <wchar.h>
rsize_t
+
(C11)
a typedef for the same type as size_t, used to self-document functions that range-check their parameters at runtime
(typedef)
Defined in header <stdint.h>
RSIZE_MAX
+
(C11)
largest acceptable size for bounds-checked functions, expands to either constant or variable which may change at runtime (e.g. as the currently allocated memory size changes)
(macro variable)
Defined in header <stdlib.h>
+
(C11)
set the error callback for bounds-checked functions
(function)
+
(C11)
abort callback for the bounds-checked functions
(function)
+
(C11)
ignore callback for the bounds-checked functions
(function)

Note: implementations of bounds-checked functions are available as open-source libraries Safe C and Slibc, and as part of Watcom C. There is also an incompatible set of bounds-checked functions available in Visual Studio.

+
(since C11)

Notes

Since C23, static_assert is itself a keyword, which may also be a predefined macro, so <assert.h> no longer provides it.

+

References

See also

+ +
+
(C99)(C99)(C99)
defines the error handling mechanism used by the common mathematical functions
(macro constant)
C++ documentation for Error handling
+

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

+
-- cgit v1.2.3