Slashdot Mirror


Null References, the Billion Dollar Mistake

jonr writes "'I call it my billion-dollar mistake. It was the invention of the null reference in 1965. At that time, I was designing the first comprehensive type system for references in an object oriented language (ALGOL W). My goal was to ensure that all use of references should be absolutely safe, with checking performed automatically by the compiler. But I couldn't resist the temptation to put in a null reference, simply because it was so easy to implement. 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. In recent years, a number of program analysers like PREfix and PREfast in Microsoft have been used to check references, and give warnings if there is a risk they may be non-null. More recent programming languages like Spec# have introduced declarations for non-null references. This is the solution, which I rejected in 1965.' This is an abstract from Tony Hoare Presentation on QCon. I'm raised on C-style programming languages, and have always used null pointers/references, but I am having trouble of grokking null-reference free language. Is there a good reading out there that explains this?"

10 of 612 comments (clear)

  1. Re:There was a bigger mistake: by Anonymous Coward · · Score: 4, Funny

    I agree.ï½ï½ï½ï½ï½ï½ï½cï½ï½A
    5ï½)ï½"ï½ï½ï½lï½3åï½ï½ï½SLï½4ï½54Vï½iï½ï½ï½D.O%N|ï½ï½ï½Tï½2nï½ì'iï½ï½ï½;ï½
                                                      ï½,ï½ï½(85ï½Iï½{ï½ï½ï½ï½)ï½Oï½Æ¼ï½%Cï½iwï½ï½ï½ï½ï½ï½I!,.ï½Õ'ï½ï½ï½ï½!ï½òfsQï½ï½zï½ï½Gï½ï½ï½aï½zï½-@ï½ yï½Ë+ï½ï½ï½Xï½ï½ï½ï½"ï½cï½âï½ï½ï½ï½ï½ï½ï½ï½ï½ï½dï½nbÕoeï½ï½ï½ï½lï½ï½ï½ï½ï½;hmï½ï½

  2. An was an even Bigger mistake: by Wargames · · Score: 5, Funny

    Zero. The bane of all. It was the gateway math to all modern problems. It would be so much simpler with just countables. Surely the current crisis, measured in trillions would look so much better without all those zeros.
    Whoever it was who invented zero should take responsibility for all the worlds problems, ex nehilo.

    --
    -- Each tock of the Planck clock is a new world and here we are still life. --
  3. Re:null or not null, that is the question by Anonymous Coward · · Score: 2, Funny

    When we do hardware debug of chips, we prefer to use a much more visible value such as 0xdeadbeef for instance.

    I've recently seen that one of our developers is using 0xfeedface 0xb00bf00d, which is nice and inventive.

  4. Bad analogy. by morgan_greywolf · · Score: 2, Funny

    Could you try a better analogy. I think we might all understand a car analogy better...

  5. Re:There was a bigger mistake: by Anonymous Coward · · Score: 5, Funny

    Just allocate the same amount of memory for everythi

  6. Re:null or not null, that is the question by johny42 · · Score: 5, Funny

    That being said, the author is not really responsible for billions of dollars of mistakes, the programmers are.

    Who am I to argue with someone that is taking resposibility for my mistakes?

  7. Re:20 second explanation by clone53421 · · Score: 2, Funny

    ...this: 'if(hashmap.exists("myvalue")'

    ...is the "correct" check anyway...

    Well, it'd be "correct" if it had the right number of parentheses, anyway! ;p

    --
    Alexander Peter Kristopeit bought his basement from his mommy for one dollar.
  8. Re:null or not null, that is the question by Toonol · · Score: 4, Funny

    MOV DX, BABA; GET UP N DANCE

  9. Re:no such requirement at the assembly level by Anonymous Coward · · Score: 0, Funny

    Yes, because Haskell doesn't operate on values or computer registers internally. It works entirely on pixie dust and unicorn tears.

    Stop the crap please. It is okay if you like the language or it fills your belly, but don't feel the need to advertise it at any unlikely opportunity. You are not welcome.

    You Haskellers are like furries or homosexuals, always needing to advertise your deviation to normal people.

    You can write side-effects-less C code just as easily as you can in Haskell. That you can do something about side effects when it makes sense instead of just abstracting them away entirely is the defining power of C.

  10. Two strings in a bar by this+great+guy · · Score: 2, Funny

    These two strings walk into a bar and sit down.
    The bartender says, So whatll it be?
    The first string says, I think Ill have a beer quag fulk boorg jdk^CjfdLk jk3s d#f67howe%^U r89nvy~~owmc63^Dz x.xvcu
    Please excuse my friend, the second string says, He isnt null-terminated.