« Back

Don't ignore compiler warnings.

I know some developers who see them as the bane of their existance, others who think that that they shouldn't even look at them and a rare few who think they are important to read.

If you didn't guess from the headline this is about compiler warnings, and I belong to the third group, the group which some think is slightly insane in their pickyness... but then again... I even care about whitespace, so I'm quite picky in general.

I think everyone shouldread these warnings, in my mind if the developers of the compiler thought it was important to notify developers about these things then there must be some reason why.

Some people say "if I really needed to do anything about it then they would be errors", but as someone who have designed applications and APIs for developers I know that there are quite a few cases when something will be possible... but far from preferable for some reason and then it may be important to alert the user to that, since they are then assuming responsibility. Basically a "you can do this, but it may or may not work as you expect".

Hence, I see it as if you were writing you important data to disk and your computer goes "I will let you write this, but it may or may not be readable". Basically you should know that if you ignore the warning there may be consequences down the line.

I have spent many hours cleaning up compiler warnings over the years, and I believe that it has been very important for the quality of code, and I believe that it could be for others as well.

Compiler developers are pretty smart people, and there is nothing wrong taking their knowledge for free. Even if you don't fix every warning you should know what they mean and how you would fix it.