One reasoned take on the various error reporting mechanisms in C++ and a policy for deciding when each is appropriate:
Exceptions, error codes, and assertions in C++
by Joseph Mansfield
From the article:
It can often be difficult to decide between the various methods of error reporting in C++. For example, some common advice is that exceptions should only be thrown in exceptional circumstances. Needless to say, this isn't particularly helpful. What exactly is an exceptional circumstance? An exception to what? If we throw assertions into the mix, this can become even more complicated.
In general, functions express a contract to the calling code...
Add a Comment
Comments are closed.