string <-> null/bool implicit conversion
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Thu Aug 20 12:55:34 PDT 2015
On 08/20/2015 09:08 PM, Steven Schveighoffer wrote:
> On 8/20/15 2:43 PM, Timon Gehr wrote:
>> 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.
>
> Same thing. [] is null.
>
> -Steve
Sure. I still consider arr!=[] cleaner style. YMMV.
More information about the Digitalmars-d
mailing list