Jim's Depository

this code is not yet written
 

Being mostly a crufty old C coder at this point, I don't use much new stuff. But I have to say the source code analysis tools are pretty nifty.
When I hit the analyzer button in Xcode to run clang's analyzer, sometimes it finds things like this for me… (A leaked buffer in a diagnostic error for one of those "can't probably happen" error checks. Just the kind of place I can get sloppy about memory ownership.)

image

I particularly like how it explains itself, that it doesn't show off (it had to know that bgetstrn() returns allocated memory without retaining ownership, it figured that out somehow, but it doesn't feel compelled to tell me about it), and that it has never given me a false positive in my code.
It has three false positives lurking in the Lua runtime, but they are in some pretty crazy code.

Attachments

analyzer.png 46187 bytes