"".dup is null

Qian Xu quian.xu at stud.tu-ilmenau.de
Mon May 4 07:22:49 PDT 2009


Steven Schveighoffer wrote:

> I think you might have a bug?
> 
> "".dup is the same as s.dup, not sure why you would expect it to be
> not-null.
> 
> -Steve

If I have not explained clearly. 
Here is the full code:

  char[] s;
  assert(s     is null);
  assert(s.dup is null);

  assert(""     !is null); // OK
  assert("".dup !is null); // FAILED

At least the last two lines behave not consistent. 
Either both are failed, or both are passed. 



More information about the Digitalmars-d-learn mailing list