On Sat, 08 Jan 2011 15:46:01 -0500, Michal Minich
<[email protected]> wrote:
On Sat, 08 Jan 2011 20:34:39 +0000, Sean Eskapp wrote:
if(left == null)
1) write if (left is null) instead if checking for null. Equality
operator is rewritten to a.opEquals(b), which you don't want if you
checking for null.
Actually, this is no longer true. For comparing two classes or
interfaces, a == b becomes .opEquals(a, b) which is defined in object.di
and properly handles null references.
However, if checking for null, a is null is going to be more correct and
as efficient as possible (a == b should be inlined to the same thing, but
only if you have inlining enabled).
-Steve