Subject: Re: [boost] [AFIO] Review (or lack of it)
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2015-08-29 07:16:54
On Friday 28 August 2015 19:15:58 Michael Marcin wrote:
> On 8/28/2015 4:31 AM, Andrey Semashev wrote:
> > Calling std::terminate is also something I would call unexpected and
> > harmful. You don't know what the application is doing - one thread may
> > be doing something with Boost.AFIO and another may be doing domething
> > important and unrelated. Throw exceptions on errors, where possible.
> > Document UB when not.
> If it's documented as UB and implemented as calling std::terminate and
> prints to std::cerr that seems to satisfy your requirements without
> making any changes to the code.
> I assume you want the code to not do this however.
By UB I mean the library doesn't attempt to recover from the error. If the
user passed an invalid pointer then let it crash. If the program logic locks
mutexes or files in an inconsistent order then let it deadlock. Or whatever
the behavior in such cases on the current platform is.
When the library attempts to recover from the error then this should be a
documented behavior, and very much defined. Documenting a well defined error
handling as UB is not useful or fair IMO.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk