null dereference

luka8088 luka8088 at owave.net
Sat Mar 15 11:24:43 PDT 2014


On 15.3.2014. 14:34, Ary Borenszweig wrote:
> On 3/15/14, 8:25 AM, bearophile wrote:
>> luka8088:
>>
>>> I was thinking and I am not sure about the reason for not having some
>>> king of safeguard for null dereferencing in version(assert)/debug
>>> builds.
>>
>> Eventually reference deference in D will be guarded by an assert in
>> non-release builds. This desire is a raising tide that eventually can't
>> be stopped.
>>
>> Bye,
>> bearophile
> 
> Really? I thought Walter was against this. He always says you can fire
> up a debugger and check where the dereference occurred.

Hm, that is true, but i think it should be a default behavior in
version(assert).

I saw many discussions on this topic and many arguments but I am still
not able to digest that the following produces invalid memory operation:

void main () @safe {
  Object o = null;
  o.toHash();
}




More information about the Digitalmars-d mailing list