D is dead

Jonathan M Davis newsgroup.d at jmdavisprog.com
Fri Aug 24 09:35:46 UTC 2018


On Friday, August 24, 2018 1:31:21 AM MDT Shachar Shemesh via Digitalmars-d 
wrote:
> > Yeah. We probably should have required that destructors be nothrow and
> > force destructor failures to be treated as Errors.
>
> I'm sorry, but I'm not following your logic.
>
> If you're willing to have an error raised by a destructor abort the
> whole program, isn't the C++ solution preferable (abort the program only
> on double errors, which hardly ever happens)?

The C++ code bases that I've worked on have typically marked destructors
with throw() or noexcept, which effectively kills your program whenever an
exception is thrown for a destructor, and I'm not sure if I've ever seen it
be triggered. It's just not a typical bug in my experience. Either way,
since I would consider it a serious bug for an exception to be thrown from a
destructor, if it happens, I'd rather have the program just die so that the
bug can be noticed and fixed.

- Jonathan M Davis





More information about the Digitalmars-d mailing list