Re: "".dup is null

2009-05-04 Thread Steven Schveighoffer
On Mon, 04 May 2009 12:09:09 -0400, Georg Wrede wrote: If I remember correctly, string literals are stored with a null appended, so as to make them easier to use with OS calls, etc. Could it be that "" stores a 1-byte string, consisting with just this null? Then this behavior would be unde

Re: "".dup is null

2009-05-04 Thread Georg Wrede
e: 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. OK, your original post was this: assert( s

Re: "".dup is null

2009-05-04 Thread Steven Schveighoffer
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. OK, your original post was this: assert( s.dup is null); // OK asse

Re: "".dup is null

2009-05-04 Thread Qian Xu
Steven Schveighoffer wrote: > On Mon, 04 May 2009 09:46:57 -0400, Qian Xu > wrote: > >> Hi All, >> >> The following code will throw an exception: >> char[] s; >> assert( s.dup is null); // OK >> assert("".dup !is null); // FAILED &g

Re: "".dup is null

2009-05-04 Thread Qian Xu
rt(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.

Re: "".dup is null

2009-05-04 Thread Steven Schveighoffer
On Mon, 04 May 2009 09:46:57 -0400, Qian Xu 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

"".dup is null

2009-05-04 Thread Qian Xu
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? --Qian