Disallow null references in safe code?
deadalnix
deadalnix at gmail.com
Sun Feb 2 17:47:17 PST 2014
On Sunday, 2 February 2014 at 23:55:48 UTC, Andrei Alexandrescu
wrote:
> On 2/2/14, 3:44 PM, Timon Gehr wrote:
>> On 02/03/2014 12:09 AM, Andrei Alexandrescu wrote:
>>>
>>> A front-end pass could replace the dead dereference with a
>>> guard that
>>> asserts the reference is not null.
>>
>> I don't think this would be feasible. (The front-end pass
>> would need to
>> simulate all back-end passes in order to find all the
>> references that
>> might be proven dead.)
>
> Well I was thinking of a backend-specific assertion directive.
> Worst case, the front end could assign to a volatile global:
>
> __vglobal = *p;
>
>
> Andrei
As far as the backend is concerned, dereferencing and assigning
to a volatile are 2 distinct operations.
More information about the Digitalmars-d
mailing list