Hacker News new | ask | show | jobs
by somefive 2744 days ago

    "The decoupling between raising of the exception and handling it, that makes avoiding failures so easy in C++."
The point of exceptions, over C-style errors codes, is that you cant forget to handle errors.

    "When you create an instance of the class, constructor is called (which cannot fail) and then you explicitly call init function (which can fail)."
That's an anti-pattern. Initialization should happen in the constructor, not be separated into another step. (Look up RAII)

If you cant make exceptions work for you (for instance if you are making drivers or embedded programs), I have good news for you. Lightweight exceptions are being worked on and will most likely end up in the standard in 2023.

http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0709r0....