(SC22WG14.323) Re: reaction to Variable Length Array Proposal

D. Hugh Redelmeier uunet!mimosa.com!hugh
Thu Feb 11 14:47:59 PST 1993


| From: jacamoonshine.llnl.gov (James Crotinger)
|
|   I think you're missing the point. People want to convert their
| libraries to C while retaining the same API so as not to break
| customer applications. The whole world is not going to convert to C
| overnight, and if C can't easily interact with Fortran, then it
| probably doesn't have a prayer of becoming widely accepted for
| numerical computing.

Hold onto your hats.  Here is a carefully qualified sentence which
is very complicated.

	If a program processed by a particular implementation of FORTRAN
	and a C program using the VLA proposal processed by a particular
	implementation of C could call each other successfuly, then the
	C program can be modified to avoid the VLA without losing this
	property.

Informally, what I'm saying is that the VLA is only needed for
convenience.  It does not make any more calling sequences
expressable.  It just allows the C programmer to use C's
multi-dimensional arrays more often AS A SHORTHAND.  And even that is
confusing to FORTRAN programmers because the subscripts are in the
wrong order!

For your amusement, here is a VLA example that avoids
reference-before-declaration and still allows the size parameter to
appear after the array parameter.  This is not intended to
illustrate the above comments but to show that the convenience
argument isn't very strong.

void
foo(double *a, int n, int m)
{
	double *aa[n] = a;
	/* now use aa in place of a */
	...
}

Hugh Redelmeier
hughamimosa.com or {utcsri, uunet!attcan, utzoo, scocan}!redvax!hugh
When all else fails: hughacsri.toronto.edu
+1 416 482-8253



More information about the Numeric-interest mailing list