Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!yale!cmcl2!stealth.acf.nyu.edu!brnstnd From: brnstnd@stealth.acf.nyu.edu Newsgroups: comp.lang.misc Subject: Re: NOT Educating FORTRAN programmers to use C Message-ID: <9738@stealth.acf.nyu.edu> Date: 23 Jan 90 18:46:28 GMT References: <17036@megaron.cs.arizona.edu> <14203@lambda.UUCP> Reply-To: brnstnd@stealth.acf.nyu.edu (Dan Bernstein) Distribution: usa Organization: IR Lines: 38 In article <14203@lambda.UUCP> jlg@lambda.UUCP (Jim Giles) writes: > From article <17036@megaron.cs.arizona.edu>, by gudeman@cs.arizona.edu (David Gudeman): > You just made it. In C there is _NO_DIFFERENCE_ between a pointer and > an array. In these other languages, there _IS_ a difference! The only problem with aliasing is parallel optimization. C compilers for vector machines provide directives to indicate that arrays x and y don't overlap. Fortran doesn't even have a standard way to specify extensions. > Also, as a less important point, C doesn't let me declare array arguments > to procedures if they are multidimensional and the array bounds in each > dimension may change from call to call. Hopefully the next ANSI C will allow foo(m,a) int m; char a[][m]. As is, it's some extra work for the programmer and, as you point out, probably some missed optimizations. [ parentheses ] If you really want to force evaluation order, use a temporary variable. C's as-if optimization is logical and powerful; if a compiler provides as many inline mathematical functions as Fortran, it can optimize them just as well. [ assignment as an expression ] I've found C's expressions to be useful syntactic devices. Sometimes I've wished for even more: something analogous to a = b the same way that a++ is analogous to ++a. I find it difficult to believe that the presence of these operators decreases productivity. The only thing about C that bothers me is its control structures. Any language that doesn't terminate all its control structures should throw out its syntax and commit suicide (pun not intended). There aren't any named loops or multilevel breaks. It's not worth leaving C for that non-Fortran called Fortran 8X (90, whatever), but it's a pain. ---Dan