Disallow null references in safe code?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Feb 1 17:01:25 PST 2014


On 2/1/14, 1:40 PM, deadalnix wrote:
> On Saturday, 1 February 2014 at 20:09:13 UTC, Andrei Alexandrescu wrote:
>> This has been discussed to death a number of times. A field access
>> obj.field will use addressing with a constant offset. If that offset
>> is larger than the lowest address allowed to the application, unsafety
>> may occur.
>>
>
> That is one point. The other point is that the optimizer can remove a
> null check, and then a load, causing undefined behavior.

I don't understand this. Program crash is defined behavior.

Andrei




More information about the Digitalmars-d mailing list