Why null reference not showing crash.

Brother Bill brotherbill at mail.com
Sat Aug 2 20:29:22 UTC 2025


 From page 233 of "Programming in D".
```
import std.stdio;
import std.exception;

void main() {
	MyClass variable;
	use(variable);
}

class MyClass {
	int member;
}

void use(MyClass variable) {
	writeln("variable: ", variable);
	
	try {
		writeln(variable.member); // ← BUG
	} catch (Exception ex) {
		writeln("Exception: ", ex);
	}
}
```

Why does this run, but not display expected null reference 
exception?


More information about the Digitalmars-d-learn mailing list