home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / software / 4937 < prev    next >
Encoding:
Text File  |  1992-12-14  |  3.1 KB  |  85 lines

  1. Newsgroups: comp.software-eng
  2. Path: sparky!uunet!think.com!sdd.hp.com!zaphod.mps.ohio-state.edu!menudo.uh.edu!sugar!claird
  3. From: claird@NeoSoft.com (Cameron Laird)
  4. Subject: Commenting style (was: C code Layout)
  5. Organization: NeoSoft Communications Services -- (713) 684-5900
  6. Date: Mon, 14 Dec 1992 14:03:10 GMT
  7. Message-ID: <Bz95pB.E62@NeoSoft.com>
  8. References: <1992Dec12.122453.8582@seq.uncwil.edu> <1992Dec12.200619.29602@fcom.cc.utah.edu> <1992Dec14.074411@eklektix.com>
  9. Lines: 74
  10.  
  11. In article <1992Dec14.074411@eklektix.com> rcd@raven.eklektix.com (Dick Dunn) writes:
  12.             .
  13.             .
  14.             .
  15. >Well, ;-) or no, that's a bad attitude.  Reality is trump; get used to it.
  16. >It's hard to defeat something that works in practice with an argument only
  17. >demonstrated on paper (or phosphor:-).
  18. >
  19. >>If you believe that K&R is "about right", then we will never
  20. >>come to agreement on what the right amount of comments is.
  21. >
  22. >If you don't understand why K&R is "about right", you need to stop and
  23. >think about the real significance of it before doing any more pontificating
  24. >about commenting code.  This is not an "Is Too!"-"Is Not!" matter; it is a
  25. >theory-vs-practice matter.
  26. I don't have anything to add to Mr. Dunn here,
  27. 'cept my ongoing admiration of those who seek
  28. out reality.
  29.             .
  30.             .
  31.             .
  32. >...and useful, necessary explanations like:
  33. >
  34. >>   /*
  35. >>    *  We are now done with the code for widget i, and while
  36. >>    *  the "for" loop will increment i again, we want to skip
  37. >>    *  the next widget and so we increment i here as well.
  38. >>    */
  39. >>
  40. >>   i = i + 1;
  41. >
  42. >The *idea* of commenting this situation is good.  You don't want somebody
  43. >looking at it, wondering whether the increment is supposed to be there or
  44. >was left over from a different sequence, etc...it's a good situation for
  45. >stopping to describe what's going on.  It's the realization that is bad.
  46. >(To a C programmer, the first problem is that the code should be
  47. >    i++;
  48. >You don't ignore the idioms of the language unless you're trying to confuse
  49. >the people reading the code.  I thought we were trying to avoid that!)
  50.             .
  51.             .
  52.             .
  53. >what Bryant is showing us here.  How about:
  54. >    i++;        /* done with widget i; skip the one after it */
  55. Nice illustration.
  56.  
  57. Small point:  I have a small bias toward grammatical,
  58. completely punctuated sentences in standard English.
  59. There's nothing wrong with Mr. Dunn's idiomatic cap-
  60. sulization, but I generally incline toward something
  61. that looks like
  62.  
  63.             /* We have finished widget i; skip the one after it. */
  64.     i++;
  65.  
  66. purely on "multi-cultural" lines.  I know all the pro-
  67. grammers from my home town could parse Mr. Dunn's
  68. comment without hesitation; I also know that anything
  69. we write today is almost certain to be read by non-
  70. native speakers of English, and by English speakers
  71. from places far removed from my idiolect.  It's good
  72. paring one's words down to just the essentials; it's
  73. also good to form those words in a syntax that is
  74. unambiguous, particularly across the ethnic boundaries
  75. that are a significant feature of our professional 
  76. landscape.
  77.             .
  78.             .
  79.             .
  80. -- 
  81.  
  82. Cameron Laird
  83. claird@Neosoft.com (claird%Neosoft.com@uunet.uu.net)    +1 713 267 7966
  84. claird@litwin.com (claird%litwin.com@uunet.uu.net)      +1 713 996 8546
  85.