Amend request (throwing error)

Skip to first unread message


Mar 18, 2016, 2:20:08 PM3/18/16

The concept and usage of error handling mechanism(throw,catch) should
have now been more widely understood through painful experiences that
it isn't suitable at all for the general programming idea of
'error handling'. For instance:

void f(int v)
if(v<5) throw std::invalid_argument("v<5");

void g() try {
catch(std::invalid_argument& e) {
// 1. The captured e is sensitive to the context, e.g. any functions
// used particularly implicit ones, and library linked.
// 2. No guarantee e is what the programmer expected!

The impact is deep in any C++ components using ctor,dtor or operator=,
..,etc, involving implicit conversions. Since the globally practical
function of the standard is educational. Text books and derivatives
have to be written on documents published by the standard committee or
C++ authorities. People writting documents feels difficult addressing
it differently. Please consider removing such 'error handling' suggest
and add some warning addressing or amend this issue.

[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: ]

Reply all
Reply to author
0 new messages