On 03/16/2012 03:28 PM, H. S. Teoh wrote:
On Fri, Mar 16, 2012 at 08:24:34AM -0400, Kevin Cox wrote:
[...]
And the previous examples were language agnostic.  In D and other
languages where the length of a string is stored we can nest strings
anywhere inside other strings.

const char[] a = "foofoo";
const char[] b = "oof";

Those can't be nested in null terminated strings, bit they can where
strings have an explicit length.

More to the point, does dmd perform this optimization currently?


T


No.

immutable string a = "123";
immutable string b = a;

void main(){writeln(a.ptr is b.ptr);} // "false"

Reply via email to