r/cpp • u/robwirving CppCast Host • Apr 20 '26
CppCast CppCast: Compiler Warnings as Errors with Keith Stockdale
https://cppcast.com/compiler_warnings_as_errors_with_keith_stockdale/
39
Upvotes
r/cpp • u/robwirving CppCast Host • Apr 20 '26
11
u/fdwr fdwr@github 🔍 Apr 20 '26
My default in most projects I work on is for all warnings to be errors, but there are certainly a few warnings that are noise, like unused parameters in implementations of interface methods (because it's quite common to only use a subset of parameters, but it's preferable to still leave the parameter named, rather than goofy tricks like leaving out the name or writing UNREFERENCED_PARAMETER macros to avoid the warning). It's just not in the same category of usefulness as say an unused local variable, which much more often is unintended.
9
u/ABlockInTheChain Apr 21 '26
There are two types of people who are philosophically opposed to treating warnings as errors:
2
u/GregCpp Apr 21 '26
I know that Jason was reddit nerd-sniping when he mentioned warnings-as-errors.
Nonetheless, I think the only question is *when* you should turn on warnings-as-errors. For us, certainly, on for development and CI builds. However, a lot of the C++ community is developing software for internal use only, or for a very controlled environment, and that colors a lot of the conventional wisdom.
We develop C++ code that we ship as source that goes into various Linux distros, among other places. The distros (and other source users) get to choose the compiler and version (within reason, of course). There's no way any reasonable human (or AI, I'm guessing) can write non-trivial lines of C++ that will compile without warnings on any future compiler than you have not seen yet. So, when we ship our source code, the cmakery defaults to warnings-as-warnings.
1
u/sheckey Apr 25 '26
I really liked this episode and I laughed along with them. They are clearly having fun and enjoy what they do.
1
u/pjmlp Apr 21 '26
I fully agree with the premise of warnings as errors, and in the context of C and C++, static analysis at very least on CI/CD checks.
The podcast also has a few gems regarding game devs point of view on C++, and how many would rather stay with something more in line with improved C, with C++17 already being too much, the Unreal PR example.
Most likely C23 would already be considered too much by the same group.