C / C++ compiler warnings: do you clean up all your code to remove them or leave them in?

前端 未结 18 2364
夕颜
夕颜 2020-12-24 00:08

I\'ve worked on many projects where I\'ve been given code by others to update. More often than not I compile it and get about 1,000+ compiler warnings. When I see compiler w

18条回答
  •  忘掉有多难
    2020-12-24 00:47

    I always enable all warnings, and then set my project to stop building if there are any warnings.

    If there are warnings, then you need to check each one to ensure that there is no problem. Doing this over and over is a waste of time. Not doing this implies will lead to errors creeping into your code.

    There are ways to remove a warning (e.g. #pragma argsused).

    Let the compiler do the work.

提交回复
热议问题