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

  1. Newsgroups: comp.software-eng
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!swrinde!emory!nastar!phardie
  3. From: phardie@nastar.uucp (Pete Hardie)
  4. Subject: Re: C code Layout
  5. Message-ID: <1992Dec15.153859.29057@nastar.uucp>
  6. Organization: Digital Transmission Systems, Duluth, GA.
  7. References: <1992Dec14.074411@eklektix.com> <1992Dec14.175533.8400@fcom.cc.utah.edu> <1992Dec15.073140@eklektix.com>
  8. Date: Tue, 15 Dec 1992 15:38:59 GMT
  9. Lines: 39
  10.  
  11. In article <1992Dec15.073140@eklektix.com> rcd@raven.eklektix.com (Dick Dunn) writes:
  12. >It explains some of the
  13. >nuances of the "One True Brace Style" (the K&R positioning of braces),
  14. >which seeks to minimize wasted vertical space.
  15.  
  16. A brief comment (NPI :->) here.  I find that the brace style:
  17.  
  18.     if(condition)
  19.     {
  20.         statement;
  21.         ...
  22.     }
  23.  
  24. is more readable than this style:
  25.  
  26.     if(condition) {
  27.         statement;
  28.         ...
  29.     }
  30.  
  31. for one main reason - the alignment of the open and close braces is the same,
  32. and this (to me) ties the block of code together.  IMHO, this outweighs the
  33. additional single line per block of vertical space.
  34.  
  35. However, for some reason, I detest the indention of the braces, like this:
  36.     if(condition)
  37.         {
  38.         statement;
  39.         ...
  40.         }
  41. although I can't come up with a single rational reason.
  42.  
  43.  
  44.  
  45. -- 
  46. Pete Hardie:  phardie@nastar  (voice) (404) 497-0101
  47. Digital Transmission Systems, Inc., Duluth GA
  48. Member, DTS Dart Team           |  cat * | egrep -v "signature virus|infection" 
  49. Position:  Goalie               |
  50.