"is null" vs "== null"
Anders F Björklund
afb at algonet.se
Sat Mar 25 08:24:57 PST 2006
Søren J. Løvborg wrote:
> I find it problematic that comparing null-values with the == operator
> crashes D programs.
Yes, this is problematic and it has been up for discussion before...
Some old threads, for reference:
2005
http://www.digitalmars.com/d/archives/digitalmars/D/21225.html
2003
http://www.digitalmars.com/d/archives/12144.html
But I don't think that the language position on "null" has changed...
A segfault is viewed as an exception, since it throws one on Windows.
And comparing with null is not defined, thus throwing one is OK there.
(Taken freely from http://www.digitalmars.com/drn-bin/wwwnews?D/13854)
It is here being compared to accessing outside of the array, or similar.
> I'd much rather see the == operator extended to deal with null-values.
I've just learned to live with the segfaults, when programming in D. :-(
Fortunately they're pretty easy to track down in the debugger, if found.
--anders
More information about the Digitalmars-d
mailing list