Is it a good idea to eliminate compiler warnings?

前端 未结 14 2652
既然无缘
既然无缘 2021-02-19 01:00

In the past I\'ve worked with -Wall and other switches for gcc to eliminate every compiler warning for projects I\'ve been involved in. Similarly, in Perl, I always program wit

14条回答
  •  野的像风
    2021-02-19 01:37

    Yes, definitely. A warning is an indication that something may be wrong in your code. Either you fix it, or you should disable the warning -- if you're not going to act on it, having the warning is just preventing you from detecting when new warnings appear.

    Easiest way to get and keep the code warning-free is simply to always compile with -Werror (/WX in Visual Studio) or equivalent.

提交回复
热议问题