== Quote from Timon Gehr (timon.g...@gmx.ch)'s article > On 08/23/2011 03:15 PM, foobar wrote: > > == Quote from bearophile (bearophileh...@lycos.com)'s article > >> foobar: > >>> you raise a valid concern but this looks too complicated. > >>> I'd suggest to simplify into only two cases. > >>> > >>> // 1) T.INIT - as you suggested the dimension should be checked > >>> auto foo = new int[][](10, 20); // correct > >>> auto foo1 = new int[][](10); // compilation error > >> Keep in mind that currently this is correct and it generates a 1D dynamic > >> array: > >> auto v = new int[10]; > > > > Isn't this an inconsistency in the language? > > > > // Generally speaking, allocates an instance of T on the heap > > auto foo = new T; > > > > However, "int[10]" and "new int[10]" are different types. > int and typeof(new int) are different types too.
"int" and "new int" are both an integer, the only difference is the memory location. "int[10]" is a fixed-size array vs. "new int[10]" which is a dynamic array with a completely different interface.