Hacker News new | past | comments | ask | show | jobs | submit login

I'm with you on "Bugs in your code are way more likely than any of the other problems, and they matter." This is very true. A while back Eric Raymond had a post called "When you see a heisenbug in C, suspect your compiler’s optimizer" (http://esr.ibiblio.org/?p=1705) which I felt was very wrong and responded with "A bad workman blames his tools" (http://blog.jgc.org/2010/02/bad-workman-blames-his-tools.htm...).

As might have been predicted the bug that Raymond was talking about wasn't caused by the optimizer at all (http://esr.ibiblio.org/?p=1705#comment-248328).

It's depressing to think that when your code works, it's almost always your fault.




I think I got my attitude from finding a bug in a major production compiler. I sent in my snippet to demonstrate the problem and got very short shrift from the company.

And they were right - my code had bugs in it.

So I recrafted my code and effectively, informally proved it to be correct. Then I sent it in again and got a formal acknowlegement that I had, indeed, found a bug.

Over the next 2 years I found 5 bugs in three different compilers, but in the first few cases I spent ages crafting my examples to prove the problem wasn't my code. Then it dawned on me, why not right the code to be correct in the first place, then I wouldn't have to re-write it when I found bugs that might be mine, and might be someone elses.

My productivity improved dramatically, and I was hooked.


Indeed. My C++ teacher's mantra for students was "the compiler is always right".

Obviously, this false, but until you are smart enough you'll never know when the compiler is wrong.


Interestingly, ESR himself says "don't claim you have found a bug unless you are very, very sure of your ground": http://catb.org/~esr/faqs/smart-questions.html#id478549




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: