home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!sol.ctr.columbia.edu!eff!news.oc.com!utacfd.uta.edu!rwsys!lerami!dalsil!titus
- From: titus@dallas.sil.org
- Newsgroups: comp.software-eng
- Subject: Re: C code layout
- Message-ID: <1992Dec17.115835.71@dallas.sil.org>
- Date: 17 Dec 92 11:58:35 CST
- Organization: Summer Institute of Linguistics, Dallas Center
- Lines: 55
-
- daves@hpopd.pwd.hp.com (Dave Straker) writes
-
- >On balance, I'd probably do a bit of both. I'd also get students
- >to mark one another's work for both, thus saving a bit of lecturer's
- >effort whilst simultaneously letting them find out the value of
- >using a style with which other people are familiar.
-
- I think Dave is on to something with requiring students
- to go over each other's work.
- I have personally done A LOT more maintenance work than
- new development, so I think I can safely speak for the poor
- maintenance hack who has to come in (sometimes MUCH!!) later
- and try to figure out what is going on. I have also
- occasionally had to go back to my own code long after
- forgetting why I did something that looks dumb at first
- glance. As a result, some of my code may contain several
- lines of comments to explain a short code fragment.
-
- For example:
-
- /* RT-11 normally caches the directory of the last device read. */
- /* If another tape, disk, or whatever is inserted in that drive, */
- /* it still assumes it has the correct directory. To get around */
- /* this, we do a dummy open on SY:, since we assume that most */
- /* input files will be on DK:. That way, when we attempt to open */
- /* a file on DK:, it doesn't have the directory in memory and */
- /* will actually read the directory. Otherwise, we may get a */
- /* "File not found" when the file is actually there. */
-
- fopen("SY:Z.X", "r");
-
- My own experience (first 2-3 years professionally
- writing device drivers in assembler) taught me the absolute
- NECESSITY of putting good comments in the code, especially
- re: register usage. I later did a maintenance job on a
- 15,000+ line C program which had previously been worked on
- by an ex FORTRAN jockey. Talk about terse, non-intuitive
- variable names!
- I now tend to, even when sketching out an algorithm on
- paper for someone, add comments as a matter of course.
-
-
- * * * * * * * * * * * * * * * * *
- Mike Titus, Programmer /\ Summer Institute
- SIL / \ of
- 7500 West Camp Wisdom Road /SIL \ Linguistics
- Dallas, Texas 75236-5699 --------
- U.S.A.
- Voice : (214) 709-2400 * Internet <titus@dallas.sil.org>
- Facsimile: (214) 709-3387 * UUCP ...utafil!txsil!dalsil!titus
-
- "I can do everything through Him who gives me strength."
-
- Philippians 4:13 (NIV)
-
-