String to boolean inconsistency

spir denis.spir at gmail.com
Sun Dec 12 01:34:11 PST 2010


On Sun, 12 Dec 2010 03:47:02 +0100
Andrej Mitrovic <andrej.mitrovich at gmail.com> wrote:

> The first one should fail since the string has length 0. If you use an
> .idup you would get the correct results:
> 
> void main()
> {
> string s = "".idup;
> assert(s);  // fails
> assert(s != null);  // ok
> }
> 
> So I guess it's a bug.
> 
> On 12/12/10, Tomek Sowiński <just at ask.me> wrote:
> > string s = "";
> > assert(s);  // ok
> > assert(s != null);  // fails
> >
> > I guess that's a bug. But which one is right?
> >
> > --
> > Tomek
> >

Is an empty array in general supposed to be false? (I thought that was wrong in D.)

Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d mailing list