Multidimensional C arrays

jsdy at SEISMO.ARPA jsdy at SEISMO.ARPA
Wed Jan 16 04:15:13 AEST 1985


> I wish you would explain how the semantics of
> 	foo( int array[rows][cols], int rows, int cols );
> would be inconsistent with those already in effect for
> constant-sized array arguments.  I don't see this at all.

Hmmm.  If I said  t h a t , then I must be working later than I thought.
I believe I confusing two things in one message.

Passing arrays by value (entirely on the stack) is inconsistent with the
current semantics.  This is what one person had suggested.  The current
semantics is that all arrays are passed by reference (pointer).

Passing a pointer to an array, after passing one or more of its
dimensions, seems to me to be consistent, but needs a lot more work on
the part of the compiler.  Which is fine with me, but I don't have time
to do it this week (month, ...).  Anybody?  Remember that this means the
dimensions must be either squirreled away or declared 'const'.  Also,
there are lots of chances now for people to break programs by changing
array sizes one place but not another ... but that's nothing gnew, I
guess.  We're not going to check array sizes, here.

Joe Yao		(UUCP!seismo!hadron!jsdy / hadron!jsdy at seismo.ARPA)



More information about the Comp.lang.c mailing list