string <-> null/bool implicit conversion

anonymous via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 20 10:01:05 PDT 2015


On Thursday, 20 August 2015 at 16:45:18 UTC, Márcio Martins wrote:
> Hi!
>
>
> string a = "";
> string b;
>
> writeln(a ? "a" : "null");
> writeln(b ? "b" : "null");
>
>
> This program outputs:
> a
> null
>
>
>
> What?
>
> I suppose this is by design, but are there any plans to 
> deprecate this?

A compiler change disallowing such use of arrays was done and 
then reverted. See 
<https://issues.dlang.org/show_bug.cgi?id=4733>. I haven't 
followed things closely enough to give you a good summary.


More information about the Digitalmars-d mailing list