Boost logo

Boost :

From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2020-03-25 22:43:30


Hi,

I noticed this as popular convention across Boost libraries (e.g. endian)
to deal with test cases that may throw or leak exceptions:

int cpp_main( int argc, char* argv[] )
{
    test();
    return ::boost::report_errors();
}

int main( int argc, char* argv[] )
{
    try
    {
        return cpp_main( argc, argv );
    }
    catch( std::exception const & x )
    {
        BOOST_ERROR( x.what() );
        return boost::report_errors();
    }
}

Is there any reason to prefer that one over this one?

int main( int argc, char* argv[] )
{
    try
    {
        test();
    }
    catch( std::exception const & x )
    {
        BOOST_ERROR( x.what() );
    }
    return boost::report_errors();
}

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net

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