On Sunday, 19 May 2013 at 20:30:28 UTC, Peter Alexander wrote:
On Sunday, 19 May 2013 at 20:03:24 UTC, Andrei Alexandrescu
wrote:
You are blowing it out of proportion. Null references are
hardly even on the radar of the bug classes I'm encountering
in the style of programming of the three groups I worked in at
Facebook, and also my previous employers. People I meet at
conferences and consulting gigs never mention null references
as a real problem, although I very often ask about problems. I
find it difficult to agree with you just to be nice.
Just because people don't mention them as a problem doesn't
mean it isn't a problem.
For what it's worth, null pointers are a real problem in the
code I work on (games). I don't know exactly what you work on,
but I find that they are more of a problem in highly stateful,
interactive applications. Things like generic libraries,
utility programs, compilers, etc. probably won't see the same
problems because they aren't very stateful or interactive.
In my experience, null pointers are easy to fix, but the risk
of them causes people to litter their code with if (ptr) tests,
often with poor handling of the failure case, which can cause
subtle bugs (no crash, but unintended code path).
Just my 2c.
Exactly !
Most of time null issue are easy to solve and is just the kind of
crap that slow you down, and once in a while this ends up being
an horrible mess.
It is also true that rare path are often badly tested (and
sometime you have no clue if the thing can be null or not, so you
don't even know how to test it). Same argument Walter like to
make about very rare failure cases apply here.