Null references (oh no, not again!)

Kagamin spam at here.lot
Fri Mar 6 01:04:25 PST 2009


> > 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.



More information about the Digitalmars-d mailing list