Boost logo

Boost :

Subject: Re: [boost] [AFIO] Review (or lack of it)
From: Gruenke,Matt (mgruenke_at_[hidden])
Date: 2015-08-30 17:54:02


-----Original Message-----
From: Boost [mailto:boost-bounces_at_[hidden]] On Behalf Of Niall Douglas
Sent: Friday, August 28, 2015 19:08
To: boost_at_[hidden]
Subject: Re: [boost] [AFIO] Review (or lack of it)

> It is trivial to redirect std::cerr elsewhere.

This assumes the user is not using std::cerr for something else. Please never use std::cerr, in a library. Every library I've seen that wants to log that "something bad happened" supports a user-supplied log function. To this end, I'd strongly prefer a configurable callback, rather than a macro. If a macro is used, then it places the burden of understanding how it interacts with the library's internal state on the user.

As for std::terminate(), if unwinding the call stack would leave the program in a state from where it could not reliably be returned to a known-good state, then I think calling std::terminate() is the best option. I understand that, in the real world, there might be error conditions (similar to assertion failures), where some inconsistency is detected. In such cases, I think it's far better to log and abort, than to try to continue in a bad state. There's no benefit to using exceptions, here - only downsides.

Matt

________________________________

This e-mail contains privileged and confidential information intended for the use of the addressees named above. If you are not the intended recipient of this e-mail, you are hereby notified that you must not disseminate, copy or take any action in respect of any information contained in it. If you have received this e-mail in error, please notify the sender immediately by e-mail and immediately destroy this e-mail and its attachments.


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