Path: utzoo!attcan!uunet!know!cs.utexas.edu!yale!cmcl2!lanl!jlg From: jlg@lanl.gov (Jim Giles) Newsgroups: comp.lang.misc Subject: Re: Fortran vs. C for numerical work - expression notation Message-ID: <8430@lanl.gov> Date: 10 Dec 90 20:51:28 GMT Organization: Los Alamos Natl Lab, Los Alamos, N.M. Lines: 34 A room full of Fortran programmers may indeed groan when someone mentions that A > B will be the new form of relational expression. They are _not_ groaning because they think it's a bad idea, they are groaning because it is a good idea that has been discussed to death in the Fortran community for nearly two decades. They groan simply because it is an old debate that they are simply tired of hearing about. Now, if you tell that same roomful that you plan to remove x**y and replace it with pow(x,y), they'll throw vegetables at you. This is because such a change is _not_ a good idea. One of the advantages to x**y or x^y over pow(x,y) is conciseness (which isn't really a word - the correct word is 'concision' :-). Another advantage is that, while different from standard mathematical notation, they are _MUCH_ closer to it. If anyone disagrees, fine - Fortran doesn't FORCE you to use the '**' operator, you can write a pow() function and call it - you can even make it a statement function so that it gets inlined. C can't offer the same privilege to converting Fortan users - there is no way in C (within the standard anyway) of defining an exponentiation operator. People who find this form most natural (most of us) cannot use it in C. Yes, C++ has allows user defined operators (or, allows users to overload existing operators, but not define new ones is the real rule). This is a good idea and _allows_ most of Fortran user's complaints about C expression notation to be fixed (I say 'allows', there is still a problem of compatibility if two sets of users pick different operators to overload, different functions to implement the overloaded functionality, etc.). But, if such overloaded operators are actually implemented as _external_ function calls, this answer is not satisfactory. (By the way, Fortran Extended has overloadable and user definable operators too.) J. Giles