Article View: alt.msdos.programmer
Article #870Re: Newbie Wants Advice on C-Programming
From: Alan Watson
Date: Fri, 25 Dec 1992 18:42
Date: Fri, 25 Dec 1992 18:42
49 lines
3061 bytes
3061 bytes
I came to C from Fortran a few years back; with a Fortran background, there are two distinct things one needs to master to program effectively in C. Firstly, one must master the new programming techniques, such as linkage classes, scope, pointers, heap memory management, and recursion. Secondly, one must master the notation and semantics of the C language -- C is a very dense and tightly-woven language. One can attempt to learn both of these concepts simultaneously, by plunging straight into C, or one can learn the first using Pascal, a much simpler, smaller, and more limited language than C. This was the path I would recommend, with a couple of months with Jensen and Wirth to learn the new concepts (where new == late 1960s) with Pascal and then a couple of weeks with Kernighan and Ritchie to learn the C language per se. There is so much new stuff in C that I would learn it first and then C++. **** Fortran possesses several advantages over C in numerical computing, but none of them are overwhelming. There are better and more extensive libraries available in Fortran (but f2c exists), Fortran compilers on fast machines generally produce better scalar code than C compilers (but only by perhaps at most 25%), Fortran has complex numbers (although these can be added easily to C++), and Fortran code will often vectorize more easily and with less intervention that C code (but often even Fortran code needs tweaking or re-writing to take full advantage). Still, I work almost exclusively in C because I find I can write, debug, and understand my programs more quickly and easily, and still get within 25% of the speed of Fortran. Your milage may vary. **** On a separate issue, some people insist on making the age-old assertion that C is a kind of portable assembly language. This is simply not true. C deals with the kind of objects and operations that many assembly languages do, but it gives one no information on the REALIZATION of the language on the machine. For example, the language does not specify the format (or even the existence) of the call stack, so it is impossible to garbage-collect the stack in standard C, just as it is impossible to do this in, say, standard Pascal. (Yes, I know one can do it in both C and Pascal for specific implementations.) It is true, however, to say that C (and similar languages, such as BCPL and BLISS) replaced assembly language in many tasks.
Technical Details
Message-ID:
<1992Dec25.184259.19106@sal.wisc.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!sal.wisc.edu!alanReferences:
<1992Dec24.230420.4243@sequent.com> <1992Dec25.050515.20871@ncsu.edu> <1992Dec25.073517.16089@grebyn.com>Show Full Headers
Complete Article Headers
Newsgroups: alt.msdos.programmer,comp.os.msdos.programmer,comp.sys.ibm.pc.programmer,comp.lang.c++,comp.lang.c Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!sal.wisc.edu!alan From: alan@sal.wisc.edu (Alan Watson) Subject: Re: Newbie Wants Advice on C-Programming Message-ID: <1992Dec25.184259.19106@sal.wisc.edu> Organization: Space Astronomy Lab, Madison WI References: <1992Dec24.230420.4243@sequent.com> <1992Dec25.050515.20871@ncsu.edu> <1992Dec25.073517.16089@grebyn.com> Date: Fri, 25 Dec 1992 18:42:59 GMT Lines: 49