NotNull pointers
Daniel Murphy
yebblies at nospamgmail.com
Wed Aug 31 22:09:52 PDT 2011
One thing that hasn't been mentioned is that asserts do not always terminate
the program. Should this program segfault?
(Not a great example, because while it does segfault inside A.fun's
contract, the contract handler's catch-all ignores it and contines, but
that's a different issue)
class X
{
invariant() {}
}
class A
{
void fun(X x)
in
{
assert(x);
}
body
{
}
}
class B : A
{
void fun(X x)
in
{
}
body
{
}
}
void main()
{
auto b = new B();
b.fun(null);
}
More information about the Digitalmars-d
mailing list