...
C11 Annex K introduced the new type errno_t
that is defined to be type int
in errno.h
and elsewhere. Many of the functions defined in C11 Annex K return values of this type [ISO/IEC 9899:2011]. The errno_t
type should be used as the type of an object that may contain only values that might be found in errno
. For example, a function that returns the value of errno
should be declared as having the return type errno_t
.
This recommendation depends on C11 Annex K being implemented. The following code can be added to remove this dependency:
...
Code Block | ||
---|---|---|
| ||
#ifndef __STDC_LIB_EXT1__ typedef int errno_t; #endif |
...
CERT C++ Secure Coding Standard | DCL09-CPP. Declare functions that return errno with a return type of errno_t |
ISO/IEC TR 24772:2013 | Ignored Error Status and Unhandled Exceptions [OYB] |
MISRA C:2012 | Directive 1.1 (required) |
Bibliography
[ISO/IEC 9899:2011] | Subclause K.3.2, "Errors <errno.h>" |
[Open Group 2004] |
...