null dereference exception vs. segfault?

bearophile bearophileHUGS at lycos.com
Mon Aug 2 15:12:49 PDT 2010


> But now it's probably nearly impossible to make D references nonnullable on default, so that syntax can't be used. And I don't what syntax to use yet. Suggestions welcome.

One of the few ideas I have had is to use the @ suffix for this:

class T {}
T nullable_reference;
T@ nonnullable_reference = new T@();
struct S {}
S nullable_pointer;
S@ nonnullable_pointer = new S@();


(Beside nonnullable class references/pointers, another way to catch bugs that I miss in D are the ranged integers of ObjectPascal/Ada. Walter doesn't like them, I think he thinks they are a failed idea, but I don't agree and I don't remember why he thinks so.)

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list