Postmortem: Template unittests are bad & you shouldn't catch Error
Ali Çehreli
acehreli at yahoo.com
Thu Oct 22 20:45:33 UTC 2020
On 10/22/20 1:33 PM, Paul Backus wrote:
> Once an Error has been thrown, the program is in an invalid state, and
> anything you do *on any thread* has undefined behavior. The only thing
> you can do safely is terminate the entire process. Stack traces can be
> retrieved after the fact from a core dump.
Which means:
1) Must still catch Error in a worker thread to be able to abort the
whole program. Otherwise no other thread is aware.
2) Is the default behavior of D runtime dumping stack trace correct? On
the one hand, it attempts to do something, which should not be
attempted. On the other hand, it does report after the program code has
stopped: there is only the stderr stream at that point.
Makes sense?
Thank you,
Ali
More information about the Digitalmars-d
mailing list