RFC: Change what assert does on error

Timon Gehr timon.gehr at gmx.ch
Fri Jul 4 21:02:08 UTC 2025


On 7/4/25 21:31, Walter Bright wrote:
> On 7/4/2025 11:49 AM, Timon Gehr wrote:
>> With: It writes a file with the full interaction log that leads to the 
>> crash.
> 
> Cleanup code is what is happening following the crash. If you're 
> logging, it would be the entry code to the function, not the cleanup. 

I am compressing and saving the data on crash. No point in spamming my 
user's hard drives with uncompressed huge log files that nobody will 
ever need to look at in almost all cases.

> What you can do is collect and log a stack trace, but that isn't cleanup 
> code.
> ...

A stack trace is a nice hint and better than nothing, but on its own it 
is very far from reproducing the issue.

>> The user can see the stack trace in a console window that is kept open 
>> using `system("pause")`. They can send the data to me and I can 
>> immediately reproduce the issue and fix the crash within 24 hours.
> 
> I'm not objecting to a stack trace.
> 

Good, but I think any objection at all to handling an error in a custom 
way that will allow reproducing it later is not an acceptable position.

You may say there is a custom assert handler, but it's not the only type 
of error. Also, you cannot safely throw an exception from a custom 
assert handler if the language insists on not doing cleanup properly.


More information about the Digitalmars-d mailing list