Fixing C's Biggest Mistake

Timon Gehr timon.gehr at gmx.ch
Fri Dec 30 21:13:48 UTC 2022


On 12/30/22 21:27, Walter Bright wrote:
> 
> Pattern matching inserts an explicit runtime check, rather than using 
> the hardware memory protection to do the check.

If the program crashes in case a reference is null, there is a bug in 
the logic of the program. If I fix that bug, the hardware memory 
protection will no longer be the one that's responsible for the check, 
just like for pattern matching. It will be explicit in the logic. I care 
about the correct program. Why would I care whether a crash costs me 
additional runtime? The check is either necessary or it is not 
necessary. If it is not necessary, even the hardware check is redundant, 
otherwise the hardware check does nothing that the compiler should not 
have caught even earlier.


More information about the Digitalmars-d mailing list