Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On 03/21/2012 11:23 AM, Bjoern Michaelsen wrote:
For the most part I would agree here. C++ exceptions are broken by design.
Allowing any kind of object (not even exception) to be thrown by default in a
function adds another _untyped_ return path (as if every function would return
a void* in addition to its return code). Which is exactly what you do _not_
want in a strongly typed environment. Since we are using bazillions of external
libraries, we have no way to fix this even if we would try to.

IMHO exceptions in C++ are a failed implementation, and if there is any general
advise about them, it is: "Avoid using C++ exceptions".

Couldn't agree less.  ;)

That C++ can throw arbitrary types, not restricted to some exception class hierarchy is rather orthogonal to the issues discussed so far in this thread. It does *not* add "another _untyped_ return path," at least not any more so than it would do if throwable types in C++ were restricted to some specific subset.

And "avoid using C++ exceptions" is throwing out the baby with the bath-water. They are not ideal, but neither are the alternatives.

Stephan

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.