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

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!mcsun!sun4nl!ruuinf!plato.phil.ruu.nl!hjv
  3. From: hjv@phil.ruu.nl (Hendrik Jan Veenstra)
  4. Subject: The Correct Way To Write C if-Statements
  5. Message-ID: <hjv.722370665@groucho.phil.ruu.nl>
  6. Sender: news@phil.ruu.nl
  7. Nntp-Posting-Host: groucho.phil.ruu.nl
  8. Organization: Department of Philosophy, University of Utrecht, The Netherlands
  9. Date: Sat, 21 Nov 1992 18:31:05 GMT
  10. Lines: 54
  11.  
  12.  
  13.  
  14. sca@gese.ge14.mdadv.gv.at (Petzi Schweda) writes:
  15.  
  16.  
  17. >In article <aaronk.193.722052372@county.lmt.mn.org>, aaronk@county.lmt.mn.org (Aaron S. Kurland) writes:
  18. >!> What do you think of this style?
  19. >|> 
  20. >|> if (cond)
  21. >|> {
  22. >|>    statement1;
  23. >|> }
  24. >|> else
  25. >|> {
  26. >|>    statement2;
  27. >|> }
  28. >|> 
  29.  
  30. >think you'll end up a little bit messy when using this one inside blocks:
  31.  
  32. >for (...)
  33. >    {
  34. >    if  (cond)
  35. >    {
  36. >        state;
  37. >    }
  38. >    else
  39. >    {
  40. >        state2;
  41. >    }
  42. >    }
  43.  
  44. Expanding the first suggestion logically would IMO render
  45.  
  46.    for (...)
  47.    {
  48.       if (...)
  49.       {
  50.          something;
  51.       }
  52.       else
  53.       {
  54.          something_else;
  55.       }
  56.    }
  57.  
  58. Also my preferred way of coding BTW...
  59.  
  60.  
  61. --
  62. Hendrik Jan Veenstra    hjv@phil.ruu.nl  *  How can I save my dreams
  63. Dept. of Philosophy                      *  in the nightmare, in the flood
  64. University of Utrecht                    *  But I try.
  65. The Netherlands                          *
  66.