Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> I regularly have to work with other people's C++ where they don't have -Wall -Werror.

To be fair, -Werror is kind of terrible. The set of warnings is very sensitive to the compiler version, so as soon as people work on the project with more than one compiler or even more than one version of the same compiler, it just becomes really impractical.

An acceptable compromise can be that -Werror is enabled in CI, but it really shouldn't be the default at least in open-source projects.



A common trope that is probably ignored or even unknown to uninformed C/C++ programmers, is that -Werr should be used for debug builds (as you use during development) and never for release builds (as otherwise it will most probably break compilation in future releases of the compiler)


> A common trope that is probably ignored or even unknown to uninformed C/C++ programmers, is that -Werr (...)

Not even that. -Wall -Werror should be limited to local builds, and should never touch any build config that is invoked by any pipeline.


No you definitely want to enforce this in CI.


> No you definitely want to enforce this in CI.

No, not really. It makes absolutely no sense to block builds for irrelevant things as passing unused arguments to a function.


> irrelevant things as passing unused arguments to a function.

That's not irrelevant. I have seen many bugs detected by that warning.


-Werror= and you can error on decide which warnings are errors. No reason to enable it globally


Yes that is the standard practice for open source projects (where it happens at all), but again that's another way in which C++ warnings are not even close to Rust errors.




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

Search: