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

> Please, no, don't use ... when distributing your code

FTFY. It's fine to use them for development, but a major pain in the ass if you are distributing your code for others to compile (looking at you, google).




Yeah, I don't care how people or organizations actually write their code, I just want to download the code they distribute (through git or tarballs) and run the commands listed in a readme without the build failing because GCC thinks there's an unnecessary number of parentheses around an expression.

The three alternatives were meant as somthing easy one could do instead of blindly using using -Werror to achieve the same advantages, but there are of course more ways to do it.

I have also had the fortune of using Goole code. I have been meaning to write a blog post about the issues one encounters when using a Goole library without being a part of Google.


I actually don't even like -Werror for development. When I'm developing/testing/debugging, I frequently want to run partially implemented functions (a good example of this is repeatedly commenting out blocks of code to bisect a problem). Trying to deal with warnings about unused variables/parameters is extremely cumbersome.


I want to opt out of bad warnings-as-errors, rather than failing to opt into good ones. -Wall -Wextra -pedantic -Werror for me - followed by a bunch of -Wno-xyz like -Wno-unused-variable.

You could also use -Wno-error=unused-variable, but I find warnings as warnings almost completely pointless outside of extremely niche circumstances. I will lose them in a sea of other errors when a template goes awry, and after fixing that and building again the warning will disappear because the TU with said warning didn't need rebuilding.


I agree. The main place I find -Werror to be valuable is on the CI server, where you're checking that committed code compiles cleanly on your target platforms.


I like having a makefile variable such that you can do "make NO_WERROR=1"




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

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

Search: