Thread overview | |||||
---|---|---|---|---|---|
|
October 03, 2016 bug, or is this also intended? | ||||
---|---|---|---|---|
| ||||
Unexpected auto-concatenation of string elements: string[] arr = ["a", "b" "c"]; // ["a", "bc"], length==2 int[] arr2 = [[1], [2] [3]]; // Error: array index 3 is out of bounds [2][0 .. 1] // Error: array index 3 is out of bounds [0..1] dmd 2.071.2-b2 |
October 03, 2016 Re: bug, or is this also intended? | ||||
---|---|---|---|---|
| ||||
Posted in reply to deed | On 10/03/2016 01:40 PM, deed wrote:
> Unexpected auto-concatenation of string elements:
>
> string[] arr = ["a", "b" "c"]; // ["a", "bc"], length==2
> int[] arr2 = [[1], [2] [3]]; // Error: array index 3 is out of
> bounds [2][0 .. 1]
> // Error: array index 3 is out of
> bounds [0..1]
>
> dmd 2.071.2-b2
Intended but on its way out. 2.072.0-b1 tells you it's deprecated.
|
October 04, 2016 Re: bug, or is this also intended? | ||||
---|---|---|---|---|
| ||||
Posted in reply to deed | On Monday, 3 October 2016 at 11:40:00 UTC, deed wrote:
> Unexpected auto-concatenation of string elements:
>
> string[] arr = ["a", "b" "c"]; // ["a", "bc"], length==2
> int[] arr2 = [[1], [2] [3]]; // Error: array index 3 is out of bounds [2][0 .. 1]
> // Error: array index 3 is out of bounds [0..1]
>
> dmd 2.071.2-b2
It comes from C.
In C you can write stuff like:
char* foo = "Foo is good but... "
"... bar is better!";
Eg static string concatenation for multiline/macros etc.
Think it was implemented this way to provide better support for converting c codebases.
|
Copyright © 1999-2021 by the D Language Foundation