Multidimensional arrays

8 views
Skip to first unread message

Peter

unread,
May 13, 2011, 4:26:52 AM5/13/11
to Compiler construction 2011
When implementing the multi dimensional arrays, is it required that
one can use an expression of type int as upper bound when using the
new key word?

as in int[][] iArray = new int[x+y][z]

or is it enough to handle constants as in new int[10][20]?

Peter

Björn von Sydow

unread,
May 13, 2011, 4:51:03 AM5/13/11
to compiler-cons...@googlegroups.com
Hi!

A restriction to constants in sizes seems way too strong. In particular, a very common situation is a function that takes an array as input and returns a new array with the same dimensions. So, I think you need to be able to handle expressions here.

Björn

Reply all
Reply to author
Forward
0 new messages