dereferencing null
Nathan M. Swan
nathanmswan at gmail.com
Mon Mar 5 22:16:52 PST 2012
On Friday, 2 March 2012 at 04:53:02 UTC, Jonathan M Davis wrote:
> It's defined. The operating system protects you. You get a
> segfault on *nix and
> an access violation on Windows. Walter's take on it is that
> there is no point
> in checking for what the operating system is already checking
> for - especially
> when it adds additional overhead. Plenty of folks disagree, but
> that's the way
> it is.
> - Jonathan M Davis
One thing we must consider is that this violates scope safety.
This scope(failure) doesn't execute:
import std.stdio;
void main() {
Object o = null;
scope(failure) writeln("error");
o.opCmp(new Object());
}
That's _very_ inconsistent with the scope(failure) guarantee of
_always_ executing.
NMS
More information about the Digitalmars-d
mailing list