Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!nrl-cmf!cmcl2!phri!marob!samperi From: samperi@marob.MASA.COM (Dominick Samperi) Newsgroups: comp.lang.fortran Subject: Re: Fortran versus C for numerical analysis Message-ID: <410@marob.MASA.COM> Date: 11 Sep 88 22:16:17 GMT References: <408@marob.MASA.COM> <3417@lanl.gov> Reply-To: samperi@marob.masa.com (Dominick Samperi) Organization: ESCC New York City Lines: 44 In article <3417@lanl.gov> jlg@lanl.gov (Jim Giles) writes: >> from the mathematical consistency of its rules; the new (strict) >What consistency? There are deliberately ambiguous features in C. Not >just in expression ordering, but in assignment ordering. For example: >what is the value of i after the expression i=f(i++)? Both ANSI and K&R >say this is undefined but _not_ illegal. And this is the language you >claim is consistent? This ambiguity is easily avoided by following the rule: "a variable that is auto-incremented/decremented should never appear on both sides of the '=' operator." One might compare this rule to the FORTRAN: "do not modify the same array by two different aliases," since both rules have in common the fact that the compiler will not make sure you obey them (though FORTRAN compilers are supposed to catch this error, I haven't seen any that do). This is the programming guideline that I was referrring to in my previous posting. >terse syntax, the lack of even the _concept_ of an array (the array syntax >is instantly turned into pointers - there is no semantic concept of arrays), C and FORTRAN handle arrays similarly, though you are permitted to do more with an array in C than you can in FORTRAN (like manipulate its address explicitly). And of course, the rows/columns are stored differently in the two languages, but I wouldn't conclude from this that C does not support the array concept. An array can be used in C just like it would be in FORTRAN (with the rows/columns reversed); there is no need to use the lower- level capabilities of C. And when arrays are passed to functions, a pointer is passed in both languages. I am not arguing that C is necessarily a good language to use for numerical analysis (which was the question that started this discussion), but I do feel that FORTRAN needs some work: should be able to hide the names of internal package function names, some data structuring facility is needed, the 6-letter restriction should be removed, the compiler should require that all variable names be explicitly declared (or at least support the VMS IMPLICIT NONE feature), more flexible comment syntax would be nice, and a standardized macro facility would help to patch up other blemishes. -- Dominick Samperi, NYC samperi@acf8.NYU.EDU samperi@marob.MASA.COM cmcl2!phri!marob uunet!hombre!samperi (^ ell)