4 ms·
> Or you compile with -Wall -Werror, as you should do for serious projects. -Wall -Werror does not catch the error described in the blog. It does get caught b
by inetknght 4y ago
> Or you compile with -Wall -Werror, as you should do for serious projects.
-Wall -Werror does not catch the error described in the blog.
It does get caught by a static analyzer though [0].
[0]: https://gcc.godbolt.org/z/nK7MdEcMj https://gcc.godbolt.org/z/nK7MdEcMj
- synergy20 4y agoclang-tidy is still probably the best static analyzer for c++, g++ needs to catch up as so far its -fanalyzer is really just for c, not c++
- inetknght 4y agoI would add that adding lots of checks can cause clang-tidy to have serious performance problems. The software I'm working on is safety-critical. I enabled every relevant checker relevant for certificates and tons of additional checkers related to usability and readability. clang-tidy now takes 3x the time it takes to compile :S I ended up splitting off a few checkers in particular into their own separate job. Some checkers are also quite broken. bugprone-unchecked-optional-access is very broken. It caused hangs, it caused crashes, it caused out-of-memory issues. Fortunately, our use of std::optional can mostly be refactored away but doing so is a significant change in the codebase.