char[] == null

Meta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 19 05:54:49 PST 2015


On Thursday, 19 November 2015 at 13:49:18 UTC, Meta wrote:
> On Thursday, 19 November 2015 at 06:57:20 UTC, Jack Applegame 
> wrote:
>> Really? http://dpaste.dzfl.pl/b11346e8e341
>
> Sorry, I said the exact opposite of what I meant to say. The 
> `assert(a == null)` *is* triggered because the expression `a == 
> null` fails, even though a.length == 0. You should not use `a 
> == null` to check if an array is empty. Always use a.length == 
> 0.

Actually, no it's not. Never mind.


More information about the Digitalmars-d-learn mailing list