Boost logo

Boost :

From: Ed Brey (brey_at_[hidden])
Date: 2001-02-20 09:34:20


Ooops. Forgot to integrate my own suggestion. Maybe this is my inner self
trying to say that it isn't worth distinguishing between failure and
non-standard return types. If one would want to distinguish, here's what it
could look like. This code snippet also raises the issue of what to do with
exit_test_failure.

int result = exit_exception_failure;
bool exception_thrown = true;

try {
  result = function_object();
  exception_thrown = false;
}
many catches {
...
}

if (!exception_thrown)
    if (result == 0 || result == exit_success)
        out << std::flush << "No errors detected." << std::endl;
    else if (result == exit_failure)
        out << std::endl << "**** Returned with failure code "
            << result << '.' << std::endl;
    else if (result == exit_test_failure)
        ??? What here? Hope there isn't a match by accident.
    else
        out << std::endl << "**** Returned with nonstandard error code "
            << result << '.' << std::endl;

if (result != 0 && result != exit_success)
    err << "********** Errors detected; see stdout for details.
***********" << std::endl;

return result;


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk