C official DOD langauge?

Charles Noren noren at dinl.uucp
Fri Jun 1 01:48:54 AEST 1990

In article <1990May30.212533.8105 at msuinfo.cl.msu.edu> 
scholten at cpsvax.cps.msu.edu (David Scholten cps) writes:

>What are the benefits of using C versus Fortran?

I used Fortran a long time ago (Fortran IV, before Fortran 77),
so some of these comments may not apply in respect to Fortran 77.
Here is the start of a list of advantages of C over Fortran and
Fortran over C:

C Advantage list:

 1.  Data Structures (Fortran IV didn't have them).
 2.  Cleaner code structures.  Rarely do you
     need labels (as you do in Fortran DO loops, computed
     goto's, etc.).  You do need lables in C case statements.
 3.  Data Pointers.  Even before I used C, there were times
     I needed to point to areas in memory (with a defined
     structure).  This was faked at various times by using
     an assembly language function or using a vendor
     supplied pointer function.  Never as clean as C
 4.  Ability to have variable argument lists.
 5.  Ability to do recursive function calls.
 6.  Macros.
 7.  Function pointers.  One time on a project we needed
     to implement a function table for a Finite State
     Machine (for a protocol processor written in
     Fortran IV -- arghhh!).  It was done with integer
     values in the table fed into a computed goto (yuk!!).
     In C, you put the function pointers right into the
     table and call them.
 8.  Free form entry of code for C vs. the reserved columns
     for Fortran (at least Fortran IV).  This allows nicer
     indentation style to make the code easier for the
     human to read.

C Disadvantage list:
 1.  Pointers.  This will take pure Fortran hackers a little
     time to get used to.  Pointers are pervasive in C.
 2.  Perhaps a little less mature library for math stuff.

Chuck Noren
NET:     ncar!dinl!noren
US-MAIL: Martin Marietta I&CS, MS XL8058, P.O. Box 1260,
         Denver, CO 80201-1260
Phone:   (303) 971-7930

More information about the Comp.lang.c mailing list