Should (p - q) be disallowed in @safe code?
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Thu Jan 1 07:27:04 UTC 2026
On 01/01/2026 8:19 PM, Walter Bright wrote:
> On 12/31/2025 10:54 PM, Richard (Rikki) Andrew Cattermole wrote:
>> Make it ptrdiff_t not size_t, and I'm happy.
>
> My bad.
I wasn't correcting you, I was saying what I wanted it to do.
```d
void func(void* a, void* b) {
ptrdiff_t diff = b - a;
// size_t diff = b - a; ERROR
assert(diff >= 0, "ARGUMENTS BACKWARDS");
}
```
More information about the Digitalmars-d
mailing list