fouts@lemming.nas.nasa.gov.nas.nasa.gov (Marty Fouts) (09/18/88)
I started the latest my-language-can-lick-your-language debate in this news group by asking for a list of diffences between C and Fortran from the point of view of a numerical analyst. I'm sorry the debate has gotten out of hand, but I did get my list. As promised, there was enough interest, so I'll sumarize. The following is a summary *WITHOUT JUDGEMENTS* of those features of C and Fortran whose differences are noticed by numerical analysts. I have had responses, both as E-Mail and on the list from numerical analysts who work primarily in C or primarily in Fortran indicating for each of these features that 1) That one language has it and the other doesn't is a big win for the one that has it. 2) That one language has it and the other doesn't is a big win for the one that doesn't. 3) That the feature is completely unimportant. In many cases, otherwise reasonable people have made claims that it is "*imposssible*" to do numerical analysis without a particular feature. I would appreciate any comments on ommisions from the list, but I am no longer interested in value judgements. +-+-+- A summary of the differences between C and Fortran from the point of view of numerical analysis. (C is K&R, Fortran is ANSI Fortran 77) 1) Missing operator: C doesn't have an exponentiation operator, (**) but requires explict calls to pow() 2) Expression evaluation: Fortran parenthesis are very useful for ordering operations which are commutative in real arithmetic but not in machine arithmetic. C is lacking this feature. 3) Operand promotion: C requires all values and all subexpressions to be promoted to type double, Fortran isn't as strict. 4) Exception handling: Neither language has adequate numerical exception handling for domain and range errors. Both have different semantics. 5) Dynamic memory allocation and pointer arithmetic: C does, Fortran doesn't. 6) Conformant arrays: Fortran allows subroutines to not need to known the shape of arrays which are passed as arguments, using the convention: SUBROUTINE SOMETHING(ANARRY,IDIM1,IDIM2) DIMENSION ANARRY(IDIM1,IDIM2) which is not present in Fortran. 7) Control structures: C has a wider variety of execution control structures than Fortran. 8) Preprocessor: C has a preprocessor as part of the language standard. Fortran doesn't. 9) Composite types: C supports composite types. Fortran doesn't. 10) Complex: C does not have a complex data type, Fortran does. +-+-+-+ I don't know who I am, why should you? +-+-+-+ | fouts@lemming.nas.nasa.gov | | ...!ames!orville!fouts | | Never attribute to malice what can be | +-+-+-+ explained by incompetence. +-+-+-+