Non-null objects, the Null Object pattern, and T.init
Walter Bright
newshound2 at digitalmars.com
Fri Jan 17 22:10:21 PST 2014
On 1/17/2014 7:38 PM, Walter Bright wrote:
> But I agree that compile time
> detect of null reference bugs is better than runtime detection of them.
BTW, the following program:
class C { int a,b; }
int test() {
C c;
return c.b;
}
When compiled with -O:
foo.d(6): Error: null dereference in function _D3foo4testFZi
It isn't much, only working on intra-function analysis and only when the
optimizer is used, but it's something. It's been in dmd for a long time.
More information about the Digitalmars-d
mailing list