www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - String array concantenation irregularities.

reply AJG <AJG nospam.com> writes:
Hi there,

The good:

void main() {
     const static int[] ints = [42];
     const static int test = 13;
     (ints ~ test).length; // Correct: length == 2
     (ints ~   13).length; // Correct: length == 2
}

The bad: Now, if we use strings instead of ints:

void main() {
     const static string[] strings = ["Foo"];
     const static string test = "Bar";
     (strings ~  test).length; // BUG1: Length == 4 ??
     (strings ~ "Bar").length; // BUG2: Won't even compile ??
}

Thoughts?
--AJG.
Sep 18 2005
parent reply =?ISO-8859-1?Q?Thomas_K=FChne?= <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

AJG schrieb:
 Hi there,
 
 The good:
 
 void main() {
     const static int[] ints = [42];
     const static int test = 13;
     (ints ~ test).length; // Correct: length == 2
     (ints ~   13).length; // Correct: length == 2
 }
 
 The bad: Now, if we use strings instead of ints:
 
 void main() {
     const static string[] strings = ["Foo"];
     const static string test = "Bar";
     (strings ~  test).length; // BUG1: Length == 4 ??
     (strings ~ "Bar").length; // BUG2: Won't even compile ??
 }
 
 Thoughts?
 --AJG.
Added to DStress as http://dstress.kuehne.cn/run/o/opCat_16_A.d http://dstress.kuehne.cn/run/o/opCat_16_B.d http://dstress.kuehne.cn/run/o/opCat_16_C.d http://dstress.kuehne.cn/run/o/opCat_16_D.d http://dstress.kuehne.cn/run/o/opCat_16_E.d http://dstress.kuehne.cn/run/o/opCat_16_G.d http://dstress.kuehne.cn/run/o/opCat_16_H.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDLmgO3w+/yD4P9tIRAvb0AKDD65q+Y7XEUNI1anp5cGmScE9oyQCfXLqH r5A+mcvmeVzxhVbfN2dhK7o= =nATo -----END PGP SIGNATURE-----
Sep 19 2005
parent AJG <AJG nospam.com> writes:
Thomas Kühne wrote:
 -----BEGIN PGP SIGNED MESSAGE-----
 Added to DStress as
 http://dstress.kuehne.cn/run/o/opCat_16_A.d
 http://dstress.kuehne.cn/run/o/opCat_16_B.d
 http://dstress.kuehne.cn/run/o/opCat_16_C.d
 http://dstress.kuehne.cn/run/o/opCat_16_D.d
 http://dstress.kuehne.cn/run/o/opCat_16_E.d
 http://dstress.kuehne.cn/run/o/opCat_16_G.d
 http://dstress.kuehne.cn/run/o/opCat_16_H.d
 
 Thomas
 -----BEGIN PGP SIGNATURE-----
 
 iD8DBQFDLmgO3w+/yD4P9tIRAvb0AKDD65q+Y7XEUNI1anp5cGmScE9oyQCfXLqH
 r5A+mcvmeVzxhVbfN2dhK7o=
 =nATo
 -----END PGP SIGNATURE-----
Great, thanks. --AJG.
Sep 19 2005