2017-05-30 2:54 GMT+02:00 Peter Dimov via Boost
Vicente J. Botet Escriba wrote:
Who prefers error() to throw if there is a value?
I do not have a strong opinion. If I will ever call it, I will make sure that the error code is there, so whatever you choose, will work for me. But just to remind everyone. We are not talking about an ordinaty throw here. It will be something like BOOST_THROW_EXCEPTION: it will throw on platforms with execeptions. On others it may abort().
I do.
I honestly don't understand the affection for undefined behavior. Not in principle, and not in this specific case.
People who argue in favour of narrow contracts want narrow contracts -- not UB. A narrow contract tells under what circumstances is it correct to call a given function. Narrow contracts in library interface do not introduce UB. Library users introduce UB when they use a library incorrectly. You cannot prevent users form using a library incorrectly. You may try to work around their incorrect usages, but it is not obviously superior a solution. Regards, &rzej;