lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Mon, Jun 29, 2020 at 1:05 PM Coda Highland <> wrote:
On Mon, Jun 29, 2020 at 2:19 PM Gé Weijers <> wrote:

Exception handling also has a bad reputation from its early years, when the languages providing it didn't yet provide the facilities to actually WRITE exception-safe code in a sensible manner and when computer scientists were still trying to work out what good abstractions and formalisms were. Modern C++ DOESN'T require you to be a guru to do it right if you use the standard tools idiomatically, and the committee is working on a way to have exceptions participate in the static type system so the compiler can catch more mistakes. (Bonus: static exceptions are not just more robust; they're also faster!)

I agree that if you use C++'s smart pointers and the related mechanisms correctly you will easily avoid space leaks, but I see a lot of code written by programmers that have a few years of experience and they do NOT consistently use these tools correctly. The language also has too many little gotchas. I would hesitate to use it for a new large project, because it's too hard to get a team of experienced C++ coders.

One issue that remains is that it's very hard to reason about the program state in a formal or semi-formal way once you add exceptions to the mix. You catch the exception, but your data structure's invariants are no longer valid. This is of course not specific to C++.