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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 29 14:19:33 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=4733

--- Comment #44 from Paul Backus <snarwin+bugzilla at gmail.com> ---
(In reply to Nick Treleaven from comment #43)
> Note that `if (arr !is null)` is equivalent to `if (arr)`. Those check both
> the .ptr and .length fields (i.e. `is null` means exactly the same as `is
> []`).

To be 100% explicit: both `if (arr !is null)` and `if (arr)` are equivalent to
`if (a.ptr || a.length)`.

--


More information about the Digitalmars-d-bugs mailing list