[Issue 13556] inconsistent 'new' syntax for arrays
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Nov 9 09:39:48 PST 2014
https://issues.dlang.org/show_bug.cgi?id=13556
Stewart Gordon <smjg at iname.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |smjg at iname.com
--- Comment #5 from Stewart Gordon <smjg at iname.com> ---
(In reply to Ketmar Dark from comment #0)
> this is accepted by DMD:
>
> int[] a0 = new int[256];
>
> and this is not:
>
> int[][] a1 = new int[256][256];
This isn't meant to work. int[][] is a dynamic array of dynamic arrays, not a
rectangular array. That is, it's a (length, pointer) tuple, which points to
the elements each of which is a (length, pointer) tuple.
On the other hand, new int[256][256] is of type int[256][] - a dynamic array of
static arrays.
(In reply to Kenji Hara from comment #3)
> Current ambituity syntax new int[2][1] should be deprecated, removed,
> and then we can reuse it for static array allocation.
What exactly are you wanting that's different from what it already does?
--
More information about the Digitalmars-d-bugs
mailing list