Any Tools to Catch Silly Mistakes in C Code?

后端 未结 11 2817
臣服心动
臣服心动 2021-02-20 08:11

I had a nasty typo that wasted my time and my colleague\'s time, it was something like this:

for (i = 0; i < blah; i++); // <- I had a semi-colon here, tha         


        
11条回答
  •  执笔经年
    2021-02-20 08:47

    In this (old) version of How to Shoot Yourself In the Foot, and in many other versions around the web, C is always the language that allows for the simplest procedure. When programming in C, you have to remember this and be careful. If you want protection, choose another language.

    This saying is attributed to Bjarne Stroustrup (C++) himself. To (mis)quote:

    "C makes it easy to shoot yourself in the foot"

提交回复
热议问题