Is it a good idea to eliminate compiler warnings?

前端 未结 14 2718
既然无缘
既然无缘 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:47

    Another reason to ensure that your code compiles with no warnings is that, if someone else* has to make changes to the code at some point in the future, a good place to start is to make sure that they can compile the code in its current form.

    However, if they do this, and see lots of warnings, are these warnings that have always existed, or have they installed the compiler incorrectly on their PC?

    At least if there's a rule (and a box to tick on the checklist, if you use one) that the code must compile without warnings, then you avoid this ambiguity.

    (* Someone else may include your future self).

提交回复
热议问题