[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 01:13:32 PST 2013
https://d.puremagic.com/issues/show_bug.cgi?id=4733
--- Comment #7 from bearophile_hugs at eml.cc 2013-11-27 01:13:24 PST ---
(In reply to comment #5)
> Warning:
>
> https://github.com/D-Programming-Language/dmd/pull/2885
The new warning is:
warning("converting dynamic arrays to boolean is deprecated, instead use
array.ptr");
For normal D programmers the right way to tell if an array (and eventually
associative array) is empty is with the std.array.empty function, that tests
the length. You don't want future normal D programmers to start using .ptr
everywhere they want to test array emptiness.
So perhaps a better warning is:
"converting dynamic arrays to boolean is deprecated, instead use
std.array.empty"
On the other hand some programmers want really meant to use ".ptr". And some
programmers want to test "arr.length || arr.ptr" and so on.
So perhaps an alternative error message is:
"converting dynamic arrays to boolean is deprecated"
--
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