Versions Compared

Key

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

...

When application-specific code detects an error, it can respond on the spot with a specific action, as in:

Code Block
bgColor#ccffcc
if (something_really_bad_happens) {
  take_me_some_place_safe();
}

...

Wiki Markup
A return type of {{errno_t}} indicates that the function returns a status indicator \[[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.

...