Simen kjaeraas <simen.kja...@gmail.com> wrote:
Ellery Newcomer <ellery-newco...@utulsa.edu> wrote:
I forget, why are we supposed to use is instead of == with null?
'[] is null' compares ptr and length, while '[] == null' compares only
the length. Weirdly though, '[] is null' is false for ptr == 0,
length != 0. Not likely to happen much in practice.
To actually answer your question, == calls opEquals for classes, and
that is called on both lhs and rhs. null.opEquals however, segfaults.
is, on the other hand, compares pointer equality, without caring for the
details of what opEquals wants to do.
--
Simen