5 ms·
I agree that using `-Werror` in release builds is a bad idea. But I don't think you need to "not make it the default" for this: just provide an easy way to disa
by bennofs 9y ago
I agree that using `-Werror` in release builds is a bad idea. But I don't think you need to "not make it the default" for this: just provide an easy way to disable it, and do it automatically for release builds. It should be on by default for any developer.
- slavik81 9y agoI used to have it on by default, but I found it getting in my way while developing. I'd do things like add some temporary debug code, or comment out part of an algorithm and then end up with a bunch of compile errors to fix. The compiler rightly points out that the code is of poor quality, but that's because I'm not done yet. Warnings in that case are still useful. If the project is otherwise warning-free then it's easy enough to spot the new warnings and judge if they represent a real mistake. My preference today is to set -Werror on CI builds. Any code that's final should be warning-free, but it's unnecessarily painful for work-in-progress.
- quotemstr 9y agoIn Java, the compiler complains about unreachable code and aborts. I think that's ridiculous. Sometimes it's useful to create unreachable code during development. int foo = doSomething(); return 0; // Debug XXX DONOTSUBMIT int bar = doSomethingElse(); return foo + bar; It's hilarious, though, that this workaround works: int foo = doSomething(); if (1 > 0) return 0; // Debug XXX DONOTSUBMIT int bar = doSomethingElse(); return foo + bar; Go's mandatory warnings are equally annoying. I'm sick and tired of little rarefied groups of language designers trying to impose their ideas about best practices on the rest of the world.
- wruza 9y agoWhat did you expect from a language that dictates to where to put your opening brace.
- vkou 9y agoWhat? That's a common style choice, not a language requirement.
- ameliaquining 9y agoYou can't put the opening brace of a block on a separate line in Go, because the parser will insert a semicolon before it.
- vkou 9y agoSorry - I thought the conversation was about Java.
- accatyyc 9y agoWhy should it? I just don’t get the obsession. As long as no one commits any warnings (and it’s easy to have a no warning policy), then I don’t see why it should be enabled. Sometimes I just quickly wanna throw in an unsafe printf here and there, or not change a type in every place when iterating and trying changes. It’s just strange to disallow yourself to try quick changes that warns because they might be unwanted in certain situations. And don’t worry, if the new idea I’m trying is worth it, I will fix it up so it doesn’t have any warnings. And I saved a lot of time by not fixing all these warnings on the previous 2 ideas I tried.
- bluGill 9y agoBecause painful experience has shown us time and time again that if a developer doesn't have it on all the time they will not let issues creep in. In theory you can use a CI system which does have it on, but those are not universal.
- accatyyc 9y agoOr... you can just fix the warnings before commiting. We have no tolerance for warnings on pushed code, and this has seriously never been a problem. It’s just annoying to have to remove every unused variable/parameter when trying changes out.