Coverity tool

retard re at tard.com.invalid
Wed Feb 10 09:28:33 PST 2010


Tue, 09 Feb 2010 18:49:31 -0800, Walter Bright wrote:

> D has moved a lot towards supplying by default a lot of what Coverity
> claims to do. By making such an expensive tool irrelevant for D, we can
> make D much more cost effective.

D doesn't provide non-nullable types and local refs can still escape the 
scope easily. There are several kinds of bugs that cause null pointer 
exceptions / segfaults. Now it took me 2 minutes to come up two examples:

class foo {
  Object a;
  this(Object a) { a = a; }

  void bar() { a.toString(); }

  Object[] baz() {
    scope Object a = new Object;
    return  [ a ];
  }
}

void main() {
  auto a = new Object;
//  auto b = new foo(a);   // segfault
//  b.baz()[0].toString(); // segfault
}



More information about the Digitalmars-d mailing list