My Kingdom For ...
Ary Borenszweig
ary at esperanto.org.ar
Thu Feb 21 14:55:29 PST 2008
Janice Caron escribió:
> On 21/02/2008, Ary Borenszweig <ary at esperanto.org.ar> wrote:
>>>> It must only be an error if c is a class reference. If it's a pointer,
>> >> it's ok
>>
>>> Why? if (p is null) works for pointers too
>> That's what I said: "If it's a pointer, it's ok" (don't show a
>> warning/error). Or are you saying something completely different?
>
> I guess I was. I suppose I was saying, let's make "== null" illegal
> for /all/ types. "== null" just isn't needed, because in /all/ cases,
> "is null" works.
That's even better than an error. :-)
But programmers are used to use "==" for comparisons with null...
Another alternative would be for the compiler to rewrite "== null" as
"is null", always.
More information about the Digitalmars-d
mailing list