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

  1. Newsgroups: comp.software-eng
  2. Path: sparky!uunet!spool.mu.edu!caen!uvaarpa!murdoch!murdoch.acc.virginia.edu!aj3u
  3. From: aj3u@onyx.cs.virginia.edu (Asim Jalis)
  4. Subject: Re: C code Layout
  5. In-Reply-To: rcd@raven.eklektix.com's message of Thu, 17 Dec 1992 08:14:51 GMT
  6. Message-ID: <AJ3U.92Dec17172600@onyx.cs.virginia.edu>
  7. Sender: usenet@murdoch.acc.Virginia.EDU
  8. Organization: University of Virginia, Charlottesville, VA 22903
  9. References: <KANZE.92Dec15171105@slsvdnt.us-es.sel.de> <1992Dec16.083733@eklektix.com>
  10.     <MARTINC.92Dec16111734@hatteras.cs.unc.edu>
  11.     <1992Dec17.081451@eklektix.com>
  12. Date: Thu, 17 Dec 1992 22:26:00 GMT
  13. Lines: 23
  14.  
  15. I prefer the K&R style of using braces with statement blocks:
  16.  
  17.     keyword (condition) {
  18.         statement1;
  19.         statement2;
  20.         statement3;
  21.     }
  22.  
  23. Two reasons: 
  24.  
  25. 1.  The closing brace can be matched with the "if", "while",
  26. "for", or "do".  There are so few keywords that it is easy to
  27. form visual associations quickly.  Thus the argument that other
  28. bracing styles make it easier to match braces is not applicable.
  29.  
  30. 2.  The statement block appears physically connected with the
  31. keyword statement.  With styles that leave a blank line between
  32. the conditional statement and the statement block a visual effect
  33. of two distinct objects is produced.  It is easier to visualize
  34. associated code if it appears as a single contiguous object.
  35.  
  36.  
  37. Asim.
  38.