string <-> null/bool implicit conversion

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 20 11:43:56 PDT 2015


On 08/20/2015 07:50 PM, Steven Schveighoffer wrote:
>
> Very true. Not much we can do about it. For now, the best thing to do is
> always compare arrays to null instead of simply if(arr):
>
> if(arr != null)
>
> Alternatively, but a little more ugly, is to check the length:
>
> if(arr.length)

Isn't the best way to compare to []?

if(arr!=[])

I think comparing to null is needlessly confusing.


More information about the Digitalmars-d mailing list