Looks like dangling point is not checked even in method mark as safe.
Example:
---
import std.stdio;

class A {
        int value;
        void set_value(int value) @safe {
                this.value = value;
        }
}

void test_safe(A a) @safe {
        a.set_value(1);
}

int main(string[] args) {
        A a = new A();
        test_safe(a);
        test_safe(null);
        test_safe(*(&a+100));
        
        writeln("done.");
        return 0;
}
---
test_safe(null);
and
test_safe(*(&a+100));
will cause segmentation fault.

I guess reason is check dangling pointer is very inefficient.
I found another post about this
http://forum.dlang.org/thread/llezieyytpcbcaoqe...@forum.dlang.org#post-miyvktgkczatvoguawda:40forum.dlang.org
null pointer is not a safety problem, but pointer like *(&a+100) maybe.

Regard.

Reply via email to