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

KPexEA picture KPexEA · Oct 8, 2008 · Viewed 10.8k times · Source

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 warnings they make me feel dirty, so my first task is to clean up the code and remove them all. Typically I find about a dozen problems like uninitialized variables such.

I don't understand why people leave them in and don't have perfectly clean compiles with no warnings. Am I missing something? Is there any valid reason to just leave them? Any horror stories to share?

Answer

Remo.D picture Remo.D · Oct 8, 2008

I would clean up any warning. Even the ones that you know are harmless (if such a thing exists) will give a bad impression of you to whoever will compile the code.

It one of the "smelly" signs I would look for if I had to work on someone else code.

If not real errors or potential future issues, it would be a sign of sloppiness