multidimensional array

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Sep 28 20:19:43 PDT 2014


On Sun, 28 Sep 2014 22:33:40 +0100
Stewart Gordon via Digitalmars-d-learn
<digitalmars-d-learn at puremagic.com> wrote:

> You can do `new ubyte[256][256]`, if the destination type is a
> ubyte[256][].  The reason is that you are performing an allocation of
> the form `new T[n]`, which means allocate an array of n instances of
> type T.  In this case, T is ubyte[256], which is a static array type.
it's completely counterintuitive. either `new ubyte[256];` should be
disallowed, or `new ubyte[256][256];` should work as i expect it to
work.

it's the same thing as with const methods: `const A foo ()`. yes,
'const' is a method attribute here, but it's counterintuitive.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20140929/0c67ff7a/attachment.sig>


More information about the Digitalmars-d-learn mailing list