Already in the 1st edition of the "White book",
Kerigham and Ritchie states the "C is a general purpose
language". However, without what is usually called
"assumed size arrays" and built-in complex, C is not
entirely suitable for numerical work. In particular,
in order to have functions which can manipulate
matrices whose dimensions are not determined at compile
time one needs pointers of the form, say,
double (*a)[n]
where n is not a compile time constant but determined
when control passes the pointer declaration. The C89
standard requires that n is a compile time constant.
After the declaration one then fetches matrix elements
with syntax
a[i][j].
In the absence of this feature, the typical
C/C++ solution is to use double pointers
double **b,
an intermediate pointer array,
and in this way we can again access matrix elements
with syntax
b[i][j].
From performance point of view, the latter solution is
a disaster, since it requires 2 defererencing steps
(just think of matrix multiply where we need to loop
over the "slow" index too).
GCC has supported variable-size pointers (and arrays)
for many years. It has been supported in fortran
at least from fortran66.
My question is simply:
Are variable-size pointers allowed in C99, which
would make the language fully suitable also for
numerical work.
Carl-Olof Almbladh