Automatic invariant generation

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 9 04:00:33 PDT 2017


On 7/9/2017 3:37 AM, Steven Schveighoffer wrote:
> Wait, you have stated many many times, a segfault is good enough, it's not worth 
> the added cost to do null pointer exceptions (a position I'm completely in 
> agreement with).

That's right.


> Yet, here is an example of where we have effectively added a 
> null pointer exception. > At the very least, this should be eliminated on Linux
> and just use the signal handling null pointer error mechanism!

You're a few years late, as pretty much nobody agreed with me that the operating 
system handling of it was plenty.


> Note that there is a significant difference between this situation (where you 
> are *adding* an extra check), and the argument to add messages to asserts (where 
> you are *already* asserting).

It's not really different. It's the desire for ever more messages. I've long 
advocated that a file/line is quite sufficient, but I seem to be in a tiny 
minority of 1. Now 2. :-)


> Also noted, even if you inline, the assert is still there. Those who want to 
> keep asserts (particularly for safety reasons), will pay this penalty.

Yup. Though at one point I advocated an option to replace the assert fails with 
a HLT instruction.


> I've been using D for 10 years, and have never triggered this assert. But I've 
> apparently paid for it that entire time.

It's always worth looking at the assembler output now and then.

---
The thing is, the bloat from all these messages and checks has caused DMD to be 
compiled with -release. Oops, that let through a few bugs.



More information about the Digitalmars-d mailing list