0

I'm taught to generally compile with gcc -Wall. Sometimes the warnings point me to logic errors in my code and I can find and correct them quickly (e.g. if I declared a variable that has not been used because I confused/mistyped variable names). But if I compile code from other sources, which seems to run fine for me, I frequently get warnings about deprecated or nonstandard language elements etc.

Do I have to worry about it? Should I update or correct these sources? From this reasoning, wouldn't it be safer to have printing all compile warnings as default and a compiler flags like -Wnone instead?

1 Answer 1

1

As it happens so often in software development, the answer is "it depends".

Personally, I find compiler warnings very useful. I try to write portable code and it is actually quite instructive to compile with different compilers under different OSes and then compare the warnings. More than once they helped me to pinpoint innocent-looking but real problems.

On the other hand, depending on your experience, you might find warnings annoying, if you really know what you're doing. Most compilers allow you to ignore particular warnings, it is advisable to consult the compiler manuals for details.

Not the answer you're looking for? Browse other questions tagged or ask your own question.