if(arr) now a warning

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 10 05:42:47 PDT 2015


On 4/10/15 7:18 AM, bearophile wrote:
> Martin Krejcirik:
>
>> I agree, people should just use arr.length.
>
> People should probably use "arr.empty".
>

empty is a negative. I'd prefer if(arr.length) instead of 
if(!arr.empty), as the latter's a double-negative.

Plus, adding arr.empty into object is kind of redundant. The only reason 
we have arr.empty is so that it becomes a range.

-Steve


More information about the Digitalmars-d mailing list