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

  1. Newsgroups: comp.software-eng
  2. Path: sparky!uunet!europa.asd.contel.com!emory!nastar!phardie
  3. From: phardie@nastar.uucp (Pete Hardie)
  4. Subject: Re: C code Layout
  5. Message-ID: <1992Dec17.161512.9019@nastar.uucp>
  6. Organization: Digital Transmission Systems, Duluth, GA.
  7. References: <1992Dec15.073140@eklektix.com> <1992Dec15.153859.29057@nastar.uucp> <1992Dec17.074616@eklektix.com>
  8. Date: Thu, 17 Dec 1992 16:15:12 GMT
  9. Lines: 42
  10.  
  11. In article <1992Dec17.074616@eklektix.com> rcd@raven.eklektix.com (Dick Dunn) writes:
  12. >I wish we had a way to get some useful objective data on this.  My hand-
  13. >wave against the argument Pete presents is that the K&R style has one line
  14. >at either end of the bracketed range, rather than two at the start and one
  15. >at the end.
  16.  
  17. I handwave back that this marks conditionals (while, do, etc) better, to
  18. call their importance out. 
  19.  
  20. (all this waving going on....creating quite a draft...)
  21.  
  22. >at the end.  Anyway, humans don't pay much attention to the brackets!  We
  23. >use indentation.  Don't believe it?  Just try people on something like:
  24. >    if (i <= 0)
  25. >        mumble = 0;
  26. >        return;
  27.  
  28. I agree that the visual nesting outperforms the textual, but neither brace
  29. style seems to definitively correct this, since it's really an error in the
  30. placement of any text.
  31.  
  32. >In general, if indentation fails to match the real nesting, people will
  33. >"see" the nesting (wrongly) implied by indentation.  Also, if you give { a
  34. >line by itself, you get the rather stringy
  35. >    }
  36. >    else
  37. >    {
  38. >instead of
  39. >    } else {
  40.  
  41. To me, this 'hides' the else, making it less visible.  It also makes it
  42. (slightly) harder to do a pattern search for ALL elses.  I can use /^else
  43. with my indentation, while I need an optional pattern to find them with
  44. your style.
  45.  
  46.  
  47.  
  48. -- 
  49. Pete Hardie:  phardie@nastar  (voice) (404) 497-0101
  50. Digital Transmission Systems, Inc., Duluth GA
  51. Member, DTS Dart Team           |  cat * | egrep -v "signature virus|infection" 
  52. Position:  Goalie               |
  53.