On 1/20/2014 8:34 PM, Brian Schott wrote:
I've checked in code to the DScanner project that gives it some basic static
analysis capabilities. When run with the --styleCheck option, it will warn about
a few things like empty declarations, implicit string concatenation, classes
with lowercase_names, catching "Exception", and a few other things.

There's a small feature wishlist in the project's README, but I'd like to get
some opinions from the newsgroup: What kinds of errors have you seen in your
code that you think a static analysis tool could help with?

Sooner or later, you're going to want to add data flow analysis. DFA will open up a universe of useful checks it can do. For example, you can do things like:

class C { int x; }
C foo() { return null; }
int bar(int i) {
    auto c = i ? foo() : new C();
    return c.x;        // error, path to null dereference
}

and a heckuva lot more.

For a laundry list, google Coverity and look at the bug reports it generates. Many of the reports have no meaning for D, as D has defined them out of existence, but there are plenty of others.

Reply via email to