4 ms·
We need more and better warning options, and more of them to be enabled by default (use -Wall -Wextra -Werror, please!). I have nothing against PVS-Studio but I
by btrask 11y ago
We need more and better warning options, and more of them to be enabled by default (use -Wall -Wextra -Werror, please!). I have nothing against PVS-Studio but I think promoting static analyzers will actually do more harm than good in the long run. Static analyzers are just compiler warnings that you have to pay for and then forget to run.
- halosghost 11y agoActually clang has a static analyzer that is free and pretty usable. Additionally, I religiously use `-Weverything -Werror` for C and specifically disable warnings I know to be false positives. People have told me that it is excessive, but I have found that it leads me to write dramatically more stable code in the long run. Clang is also planning to add some additional options in the style of -fsanitize that will allow for compile-time checking and failure on detection of undefined behavior. That is a feature I am incredibly excited for! Having runtime-checks for UB is nice, but bloats the resulting executable quite a bit (not to mention the performance penalty). But having compile-time checks would be awesome; adds a little more work for me if I've been relying on UB, but makes the code better in the long run and doesn't affect run-time unless the change was necessary anyway.