home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 16849 < prev    next >
Encoding:
Text File  |  1992-11-19  |  1.4 KB  |  51 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!news.univie.ac.at!hp4at!sca
  3. From: sca@gese.ge14.mdadv.gv.at (Petzi Schweda)
  4. Subject: Re: The Correct Way To Write C if-Statements
  5. Message-ID: <1992Nov20.093957@gese.ge14.mdadv.gv.at>
  6. Originator: sca@gese0n.ge14.mdadv.gv.at
  7. Sender: usenet@hp4at.eunet.co.at (USENET - Admin account)
  8. Nntp-Posting-Host: gese.ge14.mdadv.gv.at
  9. Organization: MD-ADV, Vienna, Austria
  10. References: <140742@lll-winken.LLNL.GOV> <1992Nov6.225622.25460@dg-rtp.dg.com> <604@ulogic.UUCP> <aaronk.193.722052372@county.lmt.mn.org>
  11. Date: Fri, 20 Nov 1992 08:39:57 GMT
  12. Lines: 37
  13.  
  14.  
  15. In article <aaronk.193.722052372@county.lmt.mn.org>, aaronk@county.lmt.mn.org (Aaron S. Kurland) writes:
  16. !> What do you think of this style?
  17. |> 
  18. |> if (cond)
  19. |> {
  20. |>    statement1;
  21. |> }
  22. |> else
  23. |> {
  24. |>    statement2;
  25. |> }
  26. |> 
  27. |> I always use the curlys even if there is only one statement in the block so 
  28. |> if I ever need to add another (or a debug statement) I can do it easily.  I 
  29. |> also like having the curly braces line up with the conditional statment.
  30.  
  31. think you'll end up a little bit messy when using this one inside blocks:
  32.  
  33. for (...)
  34.     {
  35.     if  (cond)
  36.     {
  37.         state;
  38.     }
  39.     else
  40.     {
  41.         state2;
  42.     }
  43.     }
  44.  
  45. too much paranthesis in this column, for my taste ...
  46.  
  47. go for it, Petzi
  48. #####################################################
  49. Petzi Schweda (sca@gese.ge14.mdadv.gv.at)
  50. MD-ADV, Municipality of the City of Vienna, Austria
  51.