Coverity tool
Brad Roberts
braddr at bellevue.puremagic.com
Tue Feb 9 17:56:49 PST 2010
On Tue, 9 Feb 2010, Walter Bright wrote:
> @safe guarantees memory safety, so these are non-issues in D.
>
> Using @safe makes these non-issues.
>
> As you say, exceptions solve these problems.
>
> It is a mistake to rely on the GC to free resources other than memory.
> Properly, either RAII or scope guard statements should be used, as these do
> not leak.
>
> No analysis tool can help you if you initialize things to the wrong value.
> That's very, very different from initializing things to GARBAGE and then using
> those garbage values.
>
> We've certainly had long threads about this one. I'll just state that turning
> on the optimizer will detect many cases of dereferencing null pointers.
>
> dmd already flags dead code.
Nice black and white world you are acting like you live in there Walter.
I know you know better, so why do you pretend otherwise?
You're assuming perfect use of the language and largely simple code.
Granted, there's a lot of things that D does better, and the tools in the
language make it easier to write better code... but developers are corner
cutters at heart. Additionally, not everything can be done in @safe (or
it wouldn't be an optional mode), and not everything can use RAII for
resource management.
Coverity, as has been discussed here in the past, is a very powerful tool
that solves very real world problems... at an astronomical price. A
sort-of close cousin to Coverity is Fortify. Fortify has a security slant
to it, but is solving essentially the same class of problems.
Compilers do, in concept, a lot of the things that Coverity does, but at a
very different scale. Coverty is aimed at whole application long range
effect analysis. It's got good tools for over-time analysis of builds to
help ensure incremental improvements (ie, prevent quality slipping
backwards). All in all, it's well engineered for large systems and large
teams.
I wish I had access to it for everthing I develop. Sadly, the cost is too
high.
Later,
Brad
More information about the Digitalmars-d
mailing list