You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Many existing functions that return an errno are declared as returning a value of type int. It is semantically unclear by looking at the function declaration or prototype if these functions return an error status or a value (or worse, some combination of the two).

TR 24731-1 defines a new type of errno_t }} which is type {{int in <errno.h> and elsewhere. Many of the functions defined in TR 24731-1 return values of this type. As a matter of programming style, errno_t should be used as the type of something that deals only with the values that might be found in errno. For example, a function which returns the value of errno should be declared as having the return type errno_t.

Non-Compliant Code Example


Compliant Solution


[[ISO/IEC TR 24731-2006]]
[[ISO/IEC 9899-1999:TC2]] Section 6.7.5.3, "Function declarators (including prototypes)"

  • No labels