Is it a good idea to eliminate compiler warnings?

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

    My opinion. Yes.

    Like you said at the end. It helps make the real errors more prominent.

    When you run a Perl cgi script that outputs warnings on an Apache Server, the warnings get logged in error.log. Why waste the space. Fix the warnings.

    Also I think it's a learning experience to better understand the language, and compiler. I didn't realize dynamic scoping was even a feature of Perl until I started using strict.

    0 讨论(0)
  • 2021-02-19 01:52

    It will save the compiler the time of writing out the warnings, and make it easier to find potentially hazardous warnings if you reduce the number of frivolous warnings in your code. Is that worth the time it takes to hunt down every warning and fix it? Not usually... but it's worth fixing warnings when they're obvious and easy to fix, or when you need to take the time and change the logic containing the warnings for another reason.

    0 讨论(0)
提交回复
热议问题