Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!mhuxm!mhuxf!mhuxi!mhuhk!mhuxt!houxm!ihnp4!bentley!kwh From: kwh@bentley.UUCP (KW Heuer) Newsgroups: net.lang.c Subject: C vs. FORTRAN (was: What should be added to C) Message-ID: <853@bentley.UUCP> Date: Mon, 26-May-86 14:29:38 EDT Article-I.D.: bentley.853 Posted: Mon May 26 14:29:38 1986 Date-Received: Wed, 28-May-86 01:49:03 EDT References: <1594@ecsvax.UUCP> Organization: AT&T Bell Laboratories, Liberty Corner Lines: 36 In article <1594@ecsvax.UUCP> ecsvax!dgary (D Gary Grady) writes: >Right now Fortran has four things over C: Of which I'd like to address the first two. >o A richer set of floating point operators, including exponentiation and > the so-called "in-line" functions (many of which ARE in C). I think you mean "builtin" rather than "inline". I don't even consider that a significant difference, much less an advantage of FORTRAN. Exponentiation in general is syntactically neater in FORTRAN but semantically identical on most machines. Exponentiation with integer exponents is a problem in C; it isn't even available as a library function! When the exponent is constant (usually 2 or 3 in practice) it could easily be coded inline, but it's not clear whether that's sufficient justification for making it an operator. >o A way of passing different-sized multidimensional arrays to the same > subroutine. (For instance, right now it is not possible to write a > function in C that will invert a matrix of arbitrary size without use > of some "trick," like making the incoming matrix one-dimensional and > hard-coding the subscript computation or using arrays of pointers to > pointers.) Again, this is merely a syntactic quibble -- what FORTRAN does is equivalent to the one-dimensional "trick", but it's hidden from the user. FORTRAN lets you use a variable as a bound in an array declaration, in this special case. That probably wouldn't be too hard to add to C; in fact it might be possible to generalize it to allow *any* nonstatic array declaration to have variable size (within reason). Another advantage of FORTRAN is implicit DO loops in I/O statements, and the related ability to use (constant, at least) repeat counts in FORMATs. I had a program that made this painfully clear when it was translated from FORTRAN to C. Karl W. Z. Heuer (ihnp4!bentley!kwh), The Walking Lint