home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 16624 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  1.2 KB

  1. Path: sparky!uunet!ferkel.ucsb.edu!taco!rock!stanford.edu!agate!biosci!uwm.edu!rpi!psinntp!psinntp!dg-rtp!robin!goudreau
  2. From: goudreau@robin.rtp.dg.com (Bob Goudreau)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: The Correct Way To Write C if-Statements
  5. Message-ID: <1992Nov16.175117.29633@dg-rtp.dg.com>
  6. Date: 16 Nov 92 17:51:17 GMT
  7. References: <1992Nov12.101654.21932@thunder.mcrcim.mcgill.edu> <1992Nov12.140710@gese.ge14.mdadv.gv.at> <3860@dozo.and.nl>
  8. Sender: nadmroot@dg-rtp.dg.com (nadm root login)
  9. Organization: Data General Corporation, RTP, NC
  10. Lines: 23
  11.  
  12. In article <3860@dozo.and.nl> jos@and.nl (Jos Horsmeier) writes:
  13. >
  14. >|Who the hack has invented this unlucky 
  15. >|     if  (cond) {
  16. >|         ugly_statements;
  17. >|         }
  18. >|paranthesis-into-if-line-style ????
  19. >
  20. >Well, I think it was Dennis M. Ritchie himself who did this, ...
  21.  
  22. Actually, this isn't quite right.  The K&R style is to align the
  23. terminating brace with the first letter of the "if" (or "while",
  24. etc.):
  25.  
  26.     if (cond) {
  27.         ugly_statements;
  28.     }
  29.  
  30.  
  31. ----------------------------------------------------------------------
  32. Bob Goudreau            Data General Corporation
  33. goudreau@dg-rtp.dg.com        62 Alexander Drive    
  34. +1 919 248 6231            Research Triangle Park, NC  27709, USA
  35.