Hacker News new | past | comments | ask | show | jobs | submit login

> Please, no, don't use -Werror with -Wall or -Wextra. When you write your code and compile with -Werror on your old version of GCC (either because you're behind on GCC releases, or because you wrote the code in the past), and I want to compile it with my new version which has added some warnings, I don't want to have to mess around in your build configuration and remove -Werror.

100% disagree. If compilers add new warnings it's because they have new insights in your code, and old invalid but "working" code may not work at all in the newer version and eat your hard disk. So instead of risking your data, just accept that it won't work with this newer version of the language.




A new compiler version isn't a new version of the language. Most warnings are about completely valid code which nonetheless should be avoided. Code which was correct in an earlier version if GCC continues to be correct in new versions of GCC.

Unused variables, using `if (somevar = othervar)` instead of `if ((somevar = othervar))`, code which uses operators without parentheses where GCC has decided the operator precedence is unexpected and should have extra parentheses to be clearer, a switch which doesn't cover all the values of an enum, unnecessary parentheses in a variable declaration. Those are all warnings which absolutely don't mean that the code is broken. The author should absolutely fix new warnings like that, but that shouldn't be the responsibility of someone who just wants to use your open source project.


I agree about open source projects, then compiler options should not be so strict. But during development it might be useful; I use -Werror before releasing piece of code, just not to add any new warnings.

BTW, a few years ago we had a nasty bug (feature?), that might have been prevented when converted into error, but... "because we always have very large build logs I didn't notice the new warning." http://0x80.pl/notesen/2015-03-22-compiler-warnings.html




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: