if(arr) now a warning

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 29 19:44:22 PDT 2015


On 4/29/15 8:35 PM, Martin Nowak wrote:
> Occasionally I'm using if (auto ary = func()), despite the fact that the
> semantics are wrong, but it's nice and short and works as long a func
> always returns null instead of empty slices.

I wonder if it's possible to fix this, as it is, IMO, the only 
legitimate drawback of this change. Could we make the following work?

if((auto ary = func()).length)

-Steve


More information about the Digitalmars-d mailing list