TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
C++ Coding Standard
Search

Category: Error Handling

Synopsis:Exceptions, Error Recovery, etc.


Description:
This chapter concerns error and handling through return values, status codes and C++ exceptions.

Coding Rules

NameCheckedSynopsis
ERR#001 Checked automatically with code checker Do not let destructors throw exceptions
ERR#002 Constructors of types thrown as exceptions shall not themselves throw exceptions
ERR#003 Before letting any exceptions propagate out of a member function, make certain that the class invariant holds and, if possible, leave the state of the object unchanged
ERR#004 Check the fault codes that may be received from library functions/methods even if these functions/methods seem foolproof
ERR#005 Checked automatically with code checker Check for all errors reported from functions
ERR#006 Checked automatically with code checker Don't use exception specifications, but do use noexcept when applicable
ERR#007 Throw exceptions only when a function fails to do what it is expected to do
ERR#008 Do not throw exceptions as a way of reporting uncommon values from a function
ERR#009 Use objects to manage resources
ERR#010 A resource managed by an object must be released by the object's destructor
ERR#012 Checked automatically with code checker Throw only objects of class type
ERR#013 Group related exception types by using inheritance
ERR#014 Checked automatically with code checker Do not catch objects by value
ERR#015 Always catch exceptions the caller is not supposed to know about
ERR#016 Do not catch exceptions you are not supposed to know about
ERR#017 Checked automatically with code checker A catch-all clause must do a rethrow