"".dup is null
Steven Schveighoffer
schveiguy at yahoo.com
Mon May 4 07:14:02 PDT 2009
On Mon, 04 May 2009 09:46:57 -0400, Qian Xu <quian.xu at stud.tu-ilmenau.de>
wrote:
> Hi All,
>
> The following code will throw an exception:
> char[] s;
> assert( s.dup is null); // OK
> assert("".dup !is null); // FAILED
>
> "".dup is expectly also an empty string.
> Is this a compiler bug?
>
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
More information about the Digitalmars-d-learn
mailing list