Multidimensional C arrays

jsdy at SEISMO.ARPA jsdy at SEISMO.ARPA
Fri Jan 11 19:26:33 AEST 1985


> foo(array, rows, cols)
> int array[rows][cols], rows, cols;

If this does get implemented, then I think you'd have to enforce a
restriction that 'rows' and 'cols' be "const" within the routine.
(I'll have to go look at the Standard to see whether the concept
of "const auto" occurs.)  Then, computations can take place, albeit
(as everyone agrees) a much more complex compiler to handle this.

As dgary says, evaluation of the "sizeof" operator would have to
be deferred (at least in this case) until runtime.  This may upset
people who have come to trust that a sizeof is a runtime constant.

I will re-phrase my major concern with this.  This will either
produce semantics inconsistent with those for the syntactically
similar constant-sized array arguments, or the latter must be
changed, thus breaking many programs.

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



More information about the Comp.lang.c mailing list