Variable-Length Array Parameters in NCEG C

Nelson H. F. Beebe uunet!math.utah.edu!beebe
Tue Jul 7 12:09:06 PDT 1992


The subject of variable-length array parameters has been debated
before in X3J3 and extensively surveyed in

astring{j-JCLT = "The Journal of {C} Language Translation"}

aArticle{MacDonald:JCLT-1-3-215,
  author =      "Tom MacDonald",
  title =       "Variable Length Arrays",
  journal =     j-JCLT,
  year =        "1989",
  volume =      "1",
  number =      "3",
  pages =       "215--233",
  month =       dec,
}

aArticle{Ritchie:JCLT-2-2-81,
  author =       "Dennis Ritchie",
  title =        "Variable-Size Arrays in {C}",
  journal =      j-JCLT,
  year =         "1990",
  volume =       "2",
  number =       "2",
  pages =        "81--86",
  month =        sep,
}

I believe that proposals that require run-time dimension variables be
given before the array they qualify are not acceptable, for the
following important reasons:

	(1) There is no prior case that I can think of in C where
	any restriction on order of function arguments is imposed by
	the language.

	(2) For automatic translation of Fortran code to C, such as
	by f2c, or the commercial Cobalt Blue translator, reordering
	of arguments would produce C code which did not match
	possibly well-documented Fortran code; this is extremely serious
	for large numerical libraries like LINPACK, EISPACK, and LAPACK.
	The practice in most such libraries is to declare the dimensions
	AFTER the array, not before.

[The complete BibTeX file for the Journal of C Language Translation
can be found on ftp.math.utah.edu in ~ftp/pub/tex/bib; via e-mail,
"send index from tex/bib" to tuglibamath.utah.edu.]


========================================================================
Nelson H.F. Beebe
Center for Scientific Computing
Department of Mathematics
220 South Physics Building
University of Utah
Salt Lake City, UT 84112
USA
 Tel: +1 801 581 5254
 FAX: +1 801 581 4148
 Internet: beebeamath.utah.edu
========================================================================



More information about the Numeric-interest mailing list