Safe mode in D?
Meta
jared771 at gmail.com
Thu Oct 17 16:25:51 PDT 2013
On Thursday, 17 October 2013 at 23:18:21 UTC, DDD wrote:
> I tried this code and the compiler allowed it (runtime I get
> object.Error: Access Violation). What am I doing wrong?
>
> Thanks I didn't notice
>
> @safe
> import std.stdio;
> class A {
> int x = 1;
> }
> @safe void main() {
> A a;
> a.x=9;
> }
This is more or less a different thing. SafeD doesn't guarantee
that your class references will not be null. Trying to call a
method on a null reference is perfectly valid in SafeD. There's a
pull request sitting in GitHub for a NotNull type that should be
reasonable good for ensuring that your references are not null,
but it hasn't been pulled yet.
More information about the Digitalmars-d
mailing list