if(arr) now a warning

Daniel Murphy via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 9 20:01:48 PDT 2015


"H. S. Teoh via Digitalmars-d"  wrote in message 
news:mailman.1388.1428620346.3111.digitalmars-d at puremagic.com...

> It's akin to a similar change sometime ago that made bare pointers in
> if-conditions illegal: writing `if (ptr && ...)` will cause the compiler
> to complain loudly. When this first got in, one of my projects broke,
> and I was rather annoyed at the time. However, when I got around to
> fixing it, I found that I had to write `if (ptr !is null && ...)`
> instead, which greatly clarifies the intent and readability of the code.
> Since then, I have come to appreciate this change.

Except that never happened.  Maybe you're thinking of comparing objects to 
null with ==? 



More information about the Digitalmars-d mailing list