4 ms·
> A stronger tool such as the Clang static analyzer should also be used. While also teaching students that static code analyzers are very far from infallible a
by sgbeal 3y ago
> A stronger tool such as the Clang static analyzer should also be used.
While also teaching students that static code analyzers are very far from infallible and can waste a great deal of developer time with false positives.
It happens about once every month or two that someone posts on the sqlite forum, "I've found this serious bug..." and, after some back and forth, it's revealed that they used a static analyzer or, even worse, just pasted a single internal function from the sqlite core into ChatGPT and asked it to analyze the code for them (completely free of any calling context). Roughly 9 times out of 10, static code analyzers are flat out wrong in their analysis of that particular source tree. It's very rare that a report in sqlite which stems from a static code analyzer is actually correct.
The advice given to such posters is invariably: if you can demonstrate code which tickles the bug your tool is claiming to have found, it will be treated with priority. Until then... not so much.
- ahoka 3y agoCoverity used to suggest using strncpy instead of strcpy for a while, which if you blindly follow leads to nasty errors. If someone wonders, snprintf was the correct alternative at the time, I have no idea if the C standard has anything better now.