Disallow null references in safe code?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Feb 2 15:55:48 PST 2014


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


More information about the Digitalmars-d mailing list