Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A call to f() returns a status indicator which is zero upon success, and a non-zero value upon failure indicating what went wrong.

Wiki MarkupA return type of {{errno_t}} indicates that the function returns a status indicator \[[indicator (see DCL09-A. Declare functions that return an errno error code with a return type of errno_t]\]).

While this solution is secure, it has the following drawbacks:

  • Wiki Markup
    Source and object code can significantly increase in size, perhaps by as much as 30-40% \[[Saks 07b|AA. C References#Saks 07b]\]
    Wiki Markup
  • All function return values must be checked (see \[[MEM32-C. Detect and handle memory allocation errors]\] among many others.)
  • Wiki Markup
    Functions should not return other values if they return error indicators (see \[[ERR02-A. Avoid in-band error indicators]\].)
  • Any function that allocates resources must ensure they are freed incases where errors occur.

...