home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / alt / msdos / programm / 3014 < prev    next >
Encoding:
Internet Message Format  |  1992-12-25  |  3.1 KB

  1. Xref: sparky alt.msdos.programmer:3014 comp.os.msdos.programmer:11620 comp.sys.ibm.pc.programmer:679 comp.lang.c++:18427 comp.lang.c:18892
  2. Newsgroups: alt.msdos.programmer,comp.os.msdos.programmer,comp.sys.ibm.pc.programmer,comp.lang.c++,comp.lang.c
  3. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!sal.wisc.edu!alan
  4. From: alan@sal.wisc.edu (Alan Watson)
  5. Subject: Re: Newbie Wants Advice on C-Programming
  6. Message-ID: <1992Dec25.184259.19106@sal.wisc.edu>
  7. Organization: Space Astronomy Lab, Madison WI
  8. References: <1992Dec24.230420.4243@sequent.com> <1992Dec25.050515.20871@ncsu.edu> <1992Dec25.073517.16089@grebyn.com>
  9. Date: Fri, 25 Dec 1992 18:42:59 GMT
  10. Lines: 49
  11.  
  12. I came to C from Fortran a few years back; with a Fortran background,
  13. there are two distinct things one needs to master to program
  14. effectively in C.
  15.  
  16. Firstly, one must master the new programming techniques, such as
  17. linkage classes, scope, pointers, heap memory management, and
  18. recursion.  Secondly, one must master the notation and semantics of the
  19. C language -- C is a very dense and tightly-woven language.
  20.  
  21. One can attempt to learn both of these concepts simultaneously, by
  22. plunging straight into C, or one can learn the first using Pascal, a
  23. much simpler, smaller, and more limited language than C.  This was the
  24. path I would recommend, with a couple of months with Jensen and Wirth
  25. to learn the new concepts (where new == late 1960s) with Pascal and
  26. then a couple of weeks with Kernighan and Ritchie to learn the C
  27. language per se.
  28.  
  29. There is so much new stuff in C that I would learn it first and then
  30. C++.
  31.  
  32. ****
  33.  
  34. Fortran possesses several advantages over C in numerical computing, but
  35. none of them are overwhelming.  There are better and more extensive
  36. libraries available in Fortran (but f2c exists), Fortran compilers on
  37. fast machines generally produce better scalar code than C compilers
  38. (but only by perhaps at most 25%), Fortran has complex numbers
  39. (although these can be added easily to C++), and Fortran code will
  40. often vectorize more easily and with less intervention that C code (but
  41. often even Fortran code needs tweaking or re-writing to take full
  42. advantage).  Still, I work almost exclusively in C because I find I can
  43. write, debug, and understand my programs more quickly and easily, and
  44. still get within 25% of the speed of Fortran.  Your milage may vary.
  45.  
  46. ****
  47.  
  48. On a separate issue, some people insist on making the age-old assertion
  49. that C is a kind of portable assembly language.  This is simply not
  50. true.
  51.  
  52. C deals with the kind of objects and operations that many assembly
  53. languages do, but it gives one no information on the REALIZATION of the
  54. language on the machine.  For example, the language does not specify
  55. the format (or even the existence) of the call stack, so it is
  56. impossible to garbage-collect the stack in standard C, just as it is
  57. impossible to do this in, say, standard Pascal.  (Yes, I know one can
  58. do it in both C and Pascal for specific implementations.)  It is true,
  59. however, to say that C (and similar languages, such as BCPL and BLISS)
  60. replaced assembly language in many tasks.
  61.