TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
 
ASML C Coding Standard
Search

Rule:  6.8.6.4.dChecked automatically with code checker

Synopsis:Function return values that are error codes shall not be ignored.
Language:C
Severity Level:6
Category:Statement and Blocks


Description:

Justification

If you ignore an error code and an error occurs, it will be very hard to find the root cause.

Example 1

static int ccbb_example(void)
{
   /* log error code */
   return e;
}

void CCBB_X(void)
{
   ccbb_example(); /* WRONG: return value is ignored */
}

Example 2

static int ccbb_example(void)
{
   return (e);
}

void CCBB_X(void)
{
   if (ccbb_example() == OK) /* RIGHT */
   {
      ...
   }
}