RFC: Change what assert does on error
Walter Bright
newshound2 at digitalmars.com
Fri Jul 4 07:40:40 UTC 2025
On 7/2/2025 9:35 AM, Sebastiaan Koppe wrote:
> I absolutely understand your stance. There are programs where I would blindly
> follow your advice. It's just that there 99x as many where graceful shutdown is
> better.
As the quote from me says, "Depending on one's tolerance for risk, it might
favor the user with a message about what went wrong before aborting (like a
backtrace)." That would make it up to you how graceful a shutdown is desirable.
Even so, continuing to operate the program as if the error did not happen
remains a mistake.
> Also, most triggered asserts I have seen were because of programmer bugs, as in,
> they misused some library for example, not because of actual corruption or
> violation of some basic axiom.
The behavior of assert() in D is completely customizable. But I cannot in good
conscience recommend continuing normal operation of a program after it has crashed.
More information about the Digitalmars-d
mailing list