Pointers vs. References

Ary Manzana ary at esperanto.org.ar
Wed Jun 13 05:02:03 PDT 2007


Lionello Lunesu escribió:
> That's not a bug.
> '==' and '!=' result in a call to opEquals, which is likely to segfault 
> when one of the operands is null. You should use 'is' or in your case 
> '!is'.

Can't writing

x == null, x != null

be rewritten by the compiler to

x is null, x !is null

?


I think the two firsts will always segfault. When would a user want to 
segfault her program? Or, better asked, when would a user want to do x 
== null?

Regards,
Ary



More information about the Digitalmars-d mailing list