Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Exceptions in BOOST?

I want to use boost::asio but I don't want boost to throw exceptions, because in my environment exceptions must not be raised.

I've encountered BOOST_NO_EXCEPTIONS but the documentation says that callers of throw_exception can assume that this function never returns. But how can a user supplied function not return? What replacement function would I need to insert here? Do I have to terminate the process in case boost code wants to throw an exception?

like image 619
SDD Avatar asked Feb 05 '26 19:02

SDD


1 Answers

Well, what do you want to do on error condition? BOOST_NO_EXCEPTION does not magically make Boost source code use alternative mechanism of propagating error back to callers. So, you either print an error to stderr and die, or you longjmp all the way to the top -- leaking whatever resources the functions presently on the call stack might have allocated.

like image 182
Vladimir Prus Avatar answered Feb 07 '26 09:02

Vladimir Prus