self@BAYES.ARC.NASA.GOV (Matthew Self) (10/25/88)
With gcc, there is a problem passing a dynamic array to a function when the size of the array is also an argument to the function. The problem is that the size argument must appear BEFORE the array in the prototype argument list. For exmaple, the function void test(float a[][n], int n) {} will not compile, but the function void test(int n, float a[][n]) {} will. The workaround is obvious, but it is cumbersome to force programmers to re-order the arguments of their functions. Since the prototype is purely a declaration, it would seem reasonable to permit the necessary forward reference. Using conventional function declarations, the function void test(a, n) float a[][n]; int n; {} will not compile, but the function void test(a, n) int n; float a[][n]; {} will. In this case the arguments can be left in the same order---only the type declarations need be rearranged. Matthew Self NASA Ames Research Center self@bayes.arc.nasa.gov