RFC: Change what assert does on error
Walter Bright
newshound2 at digitalmars.com
Fri Jul 4 17:48:15 UTC 2025
On 7/4/2025 12:21 AM, Jonathan M Davis wrote:
> Even if recovering is not acceptable, if the proper clean up is done when
> the stack is unwound, then it's possible to use destructors, scope
> statements, and catch blocks to get additional information about the state
> of the program as the stack unwinds. If the proper clean up is not done as
> the stack unwinds, then those destructors, scope statements, and catch
> statements will either not be run (meaning that any debugging information
> which could have been obtained from them wouldn't be), and/or only some of
> them will be run. And of course, for each such piece of clean up code that's
> skipped, the more invalid the state of the program becomes, making it that
> much riskier for any of the code that does run while the stack unwinds to
> log any information about the state of the program.
Executing clean up code (i.e. destructors) is not at all about logging errors,
because they happen through the normal error-free operation of the program. If
you were logging normal usage, you'd want the logs from before the fault
happened, not after.
More information about the Digitalmars-d
mailing list