Should (p - q) be disallowed in @safe code?

Walter Bright newshound2 at digitalmars.com
Fri Jan 2 21:03:19 UTC 2026


It seems we are in full agreement that p-q should be disallowed in @safe code, 
which is my proposal here.

BTW, p-q is not a memory safety issue. At worst you get an integer result that 
is an unpredictable value. Yes, I am suggesting expanding the scope of @safe.

`i<<j` can also result in nonsense if `j>=32`. But it is not unsafe. Given the 
pervasiveness of C, it would be insanity for a CPU to do anything other than seg 
fault or produce a random result.


More information about the Digitalmars-d mailing list