Null references (oh no, not again!)

Nick Sabalausky a at a.a
Fri Mar 6 01:24:59 PST 2009


"Kagamin" <spam at here.lot> wrote in message 
news:goqoup$jta$1 at digitalmars.com...
>> > I call it my billion-dollar mistake. It was the invention of the null
>> > reference in 1965. [...] This has led to innumerable errors,
>> > vulnerabilities, and system crashes, which have probably caused a
>> > billion dollars of pain and damage in the last forty years.
>>
>>   -- Sir Charles Hoare, Inventor of QuickSort, Turing Award Winner
>>
>> > * Accessing arrays out-of-bounds
>> > * Dereferencing null pointers
>> > * Integer overflow
>> > * Accessing uninitialized variables
>> >
>> > 50% of the bugs in Unreal can be traced to these problems!
>
> I doubt that blunt non-null forcing will solve this problem. If you're 
> forced to use non-null, you'll invent a means to fool the compiler, some 
> analogue of null reference - a stub object, which use will result into the 
> same bug, with the difference that application won't crash immediately, 
> but will behave in unpredictable way, at some point causing some other 
> exception, so eventually you'll get your crash. Profit will be 
> infinitesimal if any.

The idea is that non-null would not be forced, but rather be the default 
with an optional nullable for the times when it really is needed. 





More information about the Digitalmars-d mailing list