Should (p - q) be disallowed in @safe code?
Walter Bright
newshound2 at digitalmars.com
Fri Jan 2 20:21:41 UTC 2026
On 1/2/2026 11:20 AM, jmh530 wrote:
> On Thursday, 1 January 2026 at 06:15:09 UTC, Walter Bright wrote:
>> [snip]
>> So this would be valid, as the two pointers are known to point to the same
>> memory object.
>> [snip]
>
> To what extent can D know when pointers are known to point to the same object?
Some can be done trivially, such as (&c - &d). More can be discovered with DFA
(Data Flow Analysis), but not really that much. Just like not many cases of null
dereference can be unambiguously discovered with DFA.
More information about the Digitalmars-d
mailing list