2 ms·
The comments here reflect that since this was written, both the C++ language and programming as a whole have moved forward a decent bit. For example, the existe
by jchw 4y ago
The comments here reflect that since this was written, both the C++ language and programming as a whole have moved forward a decent bit. For example, the existence of move has made the pattern of a private constructor a bit less cumbersome. That said, I think they still raise a good point: making a reliable foundational library in C++ is hard without the privelege of being able to make a lot of assumptions about the runtime environment and compiler flags. The exceptions in dtor thing is still true, so if you can't enforce -fno-exceptions, you're left in an awkward place.
There are always more answers, but I think the fact that there's so many questions to begin with illustrates the problem.
- scaredginger 4y agoJust mark all destructors noexcept?
- jchw 4y agoNoexcept doesn't prevent your dtor from throwing, it just means that if it does throw, it will call std::terminate rather than unwind (thus, callers can assume it doesn't throw, since it will abort instead.) For the problem mentioned in the article, this is not a solution.
- usrnm 4y agoDestructors already are noexcept by default
- deleted 4y ago[deleted]