On Borrow Checking

Walter Bright newshound2 at digitalmars.com
Sun May 4 20:50:27 UTC 2025


The point of the borrow checker is to ensure there is exactly one point of 
origin for a pointer and exactly one point of termination for it.

In other words, one allocation and one free. More than one free is a memory 
safety bug, continuing to use a pointer after it is free'd is a memory safety 
bug, and never freeing a pointer is not a memory safety bug, but is still a bug.

I also like it for aesthetic purposes, as it makes code more readable.


More information about the Digitalmars-d mailing list