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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 11 21:08:13 PDT 2013


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


Dmitry S <ds.dlang at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ds.dlang at gmail.com


--- Comment #3 from Dmitry S <ds.dlang at gmail.com> 2013-05-11 21:08:09 PDT ---
I feel that there is an additional bug: "if(slice)" evaluates an empty slice as
true (as does "!!slice"), but "cast(bool)slice" does not compile ("cannot cast
slice to integral type bool").

So somehow, converting arrays to booleans isn't consistently supported, and
when it compiles, the meaning is indeed unintuitive. I agree that if conversion
to booleans is to be supported, then "non-empty" is the best meaning to go for.

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


More information about the Digitalmars-d-bugs mailing list