Versions Compared

Key

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

...

Code Block
...
if (a == b) {
  ...
}
else if (a == c) {
  ...
}
else {
  assert( (a == b) || (a == c) );
  abort();
/* handle error condition */
}
...

Non-Compliant Code Example

...

Code Block
...
enum WidgetEnum { WE_X, WE_Y, WE_Z } widget_type;

widget_type = WE_X; 
  
switch (widget_type) {
  case WE_X: 
    ...
    break;
  case WE_Y: 
    ...
    break;
  case WE_Z: 
    ...
    break;
  default:
    assert(0);
    abort();/* handle error condition */
    break;
}   
...

References

Hatton 95 Section 2.7.2 Errors of omission and addition