null dereference exception vs. segfault?

bearophile bearophileHUGS at lycos.com
Mon Aug 2 14:33:55 PDT 2010


Jonathan M Davis:
> As for indexing into an array, the array itself should be null or not. It has no 
> size if it's null, so it makes no sense to talk about large arrays which are 
> null.

Technically dynamic arrays in D are represented with a 2-word struct that contains a pointer and length. So empty dynamic arrays are two zero words. In D there is also the literal [] that in my opinion is better to represent an empty array than just "null":
http://d.puremagic.com/issues/show_bug.cgi?id=3889

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list