[Issue 4733] Possible bugs caused by dynamic arrays in boolean evaluation context

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 27 02:31:54 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=4733



--- Comment #13 from yebblies <yebblies at gmail.com> 2013-11-27 21:31:49 EST ---
(In reply to comment #12)
> (In reply to comment #11)
> > (In reply to comment #8)
> > > Or simply: use arr.length != 0
> > 
> > That is not the same as `if (arr)`, and I don't want this to make people
> > accidentally break their code.
> 
> No need to talk to me twice. Then !arr.length. That is the same as
> std.array.empty and it saves you the import.

`if (!arr.length) is the same as `if (array.length != 0), and neither are the
same as `if (arr)`, which expands to `if (arr.ptr)`.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list