dereferencing null

deadalnix deadalnix at gmail.com
Sat Mar 3 12:00:59 PST 2012


Le 03/03/2012 20:06, Walter Bright a écrit :
> On 3/3/2012 2:13 AM, bearophile wrote:
>> Walter:
>>
>>> Adding in software checks for null pointers will dramatically slow
>>> things
>>> down.
>>
>> Define this use of "dramatically" in a more quantitative and objective
>> way,
>> please. Is Java "dramatically" slower than C++/D here?
>
> You can try it for yourself. Take some OOP code of yours, and insert a
> null check in front of every dereference of the class handle.

Why would you want to check every time ? You program will get a signal 
from the system if it try to deference a null pointer, so thing can be 
done in the signal handler, and no cost is involved.


More information about the Digitalmars-d mailing list