Is it a good idea to eliminate compiler warnings?

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

提交回复
热议问题