collectExceptionMsg and emptyExceptionMsg

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Apr 18 14:52:29 PDT 2012


On 4/18/12, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> that is null == "".

Wow, I don't understand this, why is comparison with null allowed with
the equals operator for strings?

import std.stdio;

class Foo { }
void main()
{
    Foo foo;
    writeln(foo == null);  // compile error, as it should be
    writeln("" == null);  // true (why is this allowed?)
    writeln("" is null);  // false
}

Shouldn't the second call be illegal? That would remove ambiguities
between null strings and empty strings afaict.


More information about the Digitalmars-d-learn mailing list