char[] == null

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


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.


More information about the Digitalmars-d-learn mailing list