The Incredible Importance of NULL Testing
Jun. 5th, 2009 07:16 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
If you do not check for NULL pointers, you can get away with it right up until the point when the code presents you with one, at which time your code will merrily GPF. I am currently at about line 1400 in someone's 2800 line file, adding in the NULL pointer checks which aren't there at the moment.
Before I finish this, I am going to Sweet Baby Ray's for dinner.
Because I deserve it.
Before I finish this, I am going to Sweet Baby Ray's for dinner.
Because I deserve it.
no subject
Date: 2009-06-06 01:23 am (UTC)no subject
Date: 2009-06-06 03:36 am (UTC)There's still another interesting thing going on in the code, but I'm going to pass that off to the guy who wrote it and see what happens. :)
no subject
Date: 2009-06-06 10:47 am (UTC)As you might guess, I'm not a fan of design by contract.
no subject
Date: 2009-06-06 03:18 pm (UTC)I was willing to let a couple of instances pass where I could reasonably guarantee that a function call would return a valid pointer, but only because I got tired of reindenting this fellow's code. :)
(If he used my indenting and brace style, I probably would have done it, but I was doing too much hand fixup.)