[OT] OT: Null checks.

Kagamin spam at here.lot
Tue May 6 07:06:17 UTC 2025


like this
```
private void _enforceNoOverlap(const char[] action,
     uintptr_t ptr1, uintptr_t ptr2, const size_t bytes)
{
     import core.exception;
     const d = ptr1 > ptr2 ? ptr1 - ptr2 : ptr2 - ptr1;
     if (d >= bytes)
         return;
     const overlappedBytes = bytes - d;

     UnsignedStringBuf tmpBuff = void;
     string msg = "Overlapping arrays in ";
     msg ~= action;
     msg ~= ": ";
     msg ~= overlappedBytes.unsignedToTempString(tmpBuff, 10);
     msg ~= " byte(s) overlap of ";
     msg ~= bytes.unsignedToTempString(tmpBuff, 10);
     onAssertErrorMsg(__FILE__,__LINE__,msg);
     assert(0, msg);
}
```


More information about the Digitalmars-d mailing list